Design Pattern for Communication Plugins

I am developing my application to have several plugins that will provide various communication methods, such as Bluetooth, TCP, UDP, XMPP, etc.

At the moment, I have some of these communication methods included within the project. And I call one of these methods in a dirty way, using simple switching cases.

Can you recommend me some design patterns that I could apply here?

Thank you in advance!:)

+3
source share
2 answers

Enter strategy design template .

Basically, you have a “contextual” class that should perform an action differently depending on the scenario.

( Java ), , . , switch .

strategy

, Class.forName

+5

.

+2

Source: https://habr.com/ru/post/1794560/


All Articles