Stuart McCulloch wrote:
> 2009/10/26 Gili Tzabari <[email protected] 
> <mailto:[email protected]>>
> 
>            ... but in practice, how often does that actually happen? It
>     sounds to
>     me like dependency injection is mostly about testability, not code
>     reuse, and to that end ClassLoaders are actually less complex than all
>     the hoopla that Guice does under the hood (hint: Guice uses ASM which
>     uses bytecode rewriting and possibly even custom ClassLoaders).
> 
> Just wondering, have you read 
> http://martinfowler.com/articles/injection.html ?
> 
> Ironically I've found DI helps me avoid being tied to specific APIs 
> (case in point, OSGi services)
> because I can isolate their use in binding modules and providers, rather 
> than in the code itself.
> 
> And so far DI + services has definitely been good for my users :)


        Okay, I overlooked the "service locator" aspect of DI. Thing is,  how 
often do you need this sort of thing? For example, if you're writing 
Google Collections, how many of your classes are "services" and need to 
be plugable? Very few if any at all. This reminds me of the new trend of 
creating an interface for every class in the API even if there is (and 
ever will be) only one concrete implementation. Interfaces and DI have 
their uses, but applying them everywhere sounds overkill.

Gili

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to