It would also seem that the deeper your callstack, the bigger the payoff... A->B->C might not seem like such a big deal to hand-wire...
Where I see the payoff is in the bootstrapping and ability for classes deeper in the stack to @Inject dependencies that shouldn't be cared about above them... Imagine A-F instead of A-C. What happens when F needs a some sort of JMSClient depenency? DI by hand means either E has to make a static call to a ClientFactory (making E less testable for F's sake).. or, you bubble up the JMSClient interface and pass it all the way down from A.. I'd concede that DI by hand gives you much of the testability.. I think what Guice seems to add is the ability to decouple groups of classes by limiting the knowledge of dependent interfaces to the classes that care about them. Then again, I'm just starting to implement it.. so what do I know :) Phill On Sep 11, 5:28 pm, Pyrolistical <[EMAIL PROTECTED]> wrote: > I have watched that, and I don't see why DI by hand is any worst than > Guice. Its solves all your main problems with testability. > > The ClientFactory in your DI by hand example is very similar to a > Provider in a Module for the Injector. > > So how is Guice any better than DI by hand? > > On Sep 11, 5:17 pm, "Bob Lee" <[EMAIL PROTECTED]> wrote: > > > On Thu, Sep 11, 2008 at 5:10 PM, Pyrolistical <[EMAIL PROTECTED]> wrote: > > > > This is my point. If using new breaks Guice, then what's the point of > > > Guice. > > > > If I need to pass an Injector around to create classes, why don't I > > > just pass in the dependencies when I use the new constructor? I can > > > just replace the Injector with a class that holds references to my > > > dependencies. I would create this class at main just like configuring > > > a module. > > > > If I did that, what's the point of Guice? > > >http://crazybob.org/2007/06/introduction-to-guice-video-redux.html > > > Bob --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "google-guice" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/google-guice?hl=en -~----------~----~----~----~------~----~------~--~---
