I am looking for the best approach to design the following system :
- I have a class of object, called Compilers (C, Go..Etc)
- I have another class of object, called Protocols (HTTP, RPC, WEBSOCKET..Etc)
- I have another class of object, called Serialization (BINARY, JSON..Etc)
Now each compiler has to be matched with the right implementation of the protocol and the serialization.
For instance, if the compiler is C, then it should be matched with CProtocolHTTP or CProtocolRPC w.r.t the protocol and CSerializationBinary or CSerializationJson w.r.t Serialization, if the compiler is Go it should be matched with GoProtocolHTTP or GoProtocolRPC w.r.t the protocol and GoSerializationBinary or GoSerializationJson w.r.t Serialization.
The client should have the choice to choose any combination :
- Go with HTTP and BINARY
- Go with HTTP and JSON
- Go with RPC and BINARY
- C with HTTP and JSON ...etc
I tried Factory and Strategy but I was unable to make them work in a neat way.
What would be the right design patterns to use in order to implement this in Java ?