My scenario involves the following classes:
I have three types of
Peer that creates a
RegistryType instance because its methods are needed. Same for
Identity class. Each
PeerType need 0 or all the
RegistryType methods in order to accomplish their work. Every
Peer is then run by creating a
Server instance that makes use of one of the methods defined by the
Peer by passing a callback.
What I’m trying to achieve is to solve the tight coupling between the
PeerType classes and the
RegistryType class. My idea is to define a general
Peer class from which every type inherits and define the dependency with the
The target language is Python so either constructing the
Peers with a
RegistryType or a
Registry is ok.
Even after defining a new
Peer class to encapsulate the
RegistryType I reckon the two classes are still tight coupled so (maybe) a solution would be to pass a
RegistryType instance to the
Peer class instead of constructing it inside its constructor.
I hope to receive some great suggestions. Thanks.