Yo, I'm in a bind and I'm not sure how to resolve this. I'm having an issue with message passing in OOP.
There is an object foo, and it has an object bar. When I instance foo, I also need to pass information to the bar object within foo. Since it's not a good idea to do message passing like this due to very high coupling problems, it's better to create the bar instance and pass that instance into foo's constructor.
But that doesn't solve the coupling problem. Now there's no message passing, but bar is highly coupled with foo. Any change in methods of bar will require a change in foo and any other object which needs a bar object.
How do you solve this problem? It's driving me nuts.
Bookmarks