I have two classes which are somewhat tightly coupled to one another. Lets call them A and B. A derives from C and B derives from D.
B is the class whose instance is created by the system and then B in turn creates instance of A and also starts executing an application that B will interact and control execution of.
All the logic that B needs is in A and A also has all the supporting objects that are needed to perform the actions requested by A.
Now B is becoming kind of like the omniscient class which is not good. I am planning to separate out the logic in B and also moe the important objects needed to pereform actions out from B to a registry. Please note that the important objects that B holds are public and can be used by other classes if needed.
Now the way I am planning on doing it is that move all the important objects in B to a registry which can be accessed by other as well. Move all the logic needed by A into A itself (we thought of moving it out to a separate class but decided to just move it out to A). Still since B derives from D, there are some functionalities that we are deriving from D that needs to stay in B which are needed to perform actions requested by A.
Apologies for the long description, I would request you to critique on whether moving the important objects out to registry will be a good idea. if not what will be the better way. Another thing would be since A and B need each other they will be coupled but what will be the better way to proceed keeping the logic in A and referring to B for only the functionalitites it is deriving from D?
To add A is curently a thin layer which received requests over the newtwork and asks B to perform those actions.
Thanks in advance.
6