Forum Post: Re: do you inject ?

Status
Not open for further replies.
J

jmls

Guest
yeah, interfaces are the key - but it was just that B would have to call the factory that I was uncomfortable with. On 4 October 2014 18:08, Julian Lyndon-Smith wrote: old world is still the good world ;) so, take this scenario Class A needs Class B needs Class C they all need a logger instance. so A gets the logger instance from the "main" framework. A passes it to B, which passes it to C. all well and good. *but* now C needs a stomp connector instance so, does C interrogate the factory (as A and B don't need it) or should it be passed down the chain from A to B to C (even though A and B don;t need it) do things get more complicated if C can be instantiated from D ? form a DI point of view, C needs to be passed the stomp connector. It seems kinda wrong for C to call the factory. But then it seems wrong that B (and therefore A) must have a stomp instance that they never use On 4 October 2014 18:01, Bronco wrote: RE: do you inject ? Reply by Bronco Well, I'm still in the old world as well. And it's weekend here ;-) Anyway, concerning your question. I use both, Factory controlling lifespan and default implementation of interfaces, and inject what object comes out of the factory into whatever needs it. Stop receiving emails on this subject. Flag this post as spam/abuse. -- Julian Lyndon-Smith IT Director, dot.r http://www.dotr.com -- Julian Lyndon-Smith IT Director, dot.r http://www.dotr.com

Continue reading...
 
Status
Not open for further replies.
Top