Re: IoC and Encapsulation
Leandro Rodrigo Saad Cruz <[email protected]> Fri, 26 Mar 2004 10:21:15 -0300
| Newsgroups | gmane.comp.java.jcontainer.interest |
|---|---|
| Organization | Inter Business Tecnologia e Sevi??os |
| Message-ID | <1080307275.521.6.camel@zacarias> |
I dunno what others think about this, but I always use a factory (http://xingu.sf.net - ObjectFactory) to create my objects and handle them references to other objects/components they might need. On Fri, 2004-03-26 at 06:32, anders.janmyr wrote: > 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 > _______________________________________________ > jcontainer-interest mailing list > jcontainer-interest-81qHHgoATdGxIXFVlbCvtR2eb7JE58TQ@public.gmane.org > http://lists.codehaus.org/mailman/listinfo/jcontainer-interest -- Leandro Rodrigo Saad Cruz InterBusiness Tecnologia e Serviços IB - www.ibnetwork.com.br DB - www.digitalbrand.com.br OJB - db.apache.org/ojb XINGU - xingu.sf.net