IoC and Encapsulation
"anders.janmyr" <[email protected]> Fri, 26 Mar 2004 10:32:36 +0100
| Newsgroups | gmane.comp.java.jcontainer.interest |
|---|---|
| Message-ID | <[email protected]> |
Hello, I'm not sure if this is an appropriate place for this question, but since the containers involved are mostly based on the IoC principle I figured I would pose it here anyaway. I apologize if it's not the proper forum. If I have an object (myObject) that uses a few other objects according to IoC I would like to create these objects outside to enforce the isolation of my object. By forcing the client to create these objects I force it to know more than it has to just to isolate myObject thus violating the principle of encapsulation. What are the best practices for using IoC? Should I use default values for clients with simple needs? Should I use a convenience factory method? Should I use a facade like class to hide my internals? Any thoughts are appreciated. Regards Anders