I find it pretty interesting that such /absolutely fundamental/
aspects are discussed: In essence, the actual reason for Guice and
other DI frameworks' existence.

For my part, I side with at least Daniel, but actually find the answer
even more on the opposite of Dhanji's arguments, and IIUC, so does at
least the entire Spring world: I believe the stance there is that you
do /not/ use the framework for testing - in tests, you actually wire
up the tested class by hand, of course mocking some or all of the
dependencies. When that is said, I personally often find myself doing
higher level integration testing, and thus I use Guice but with some
modules switched out with testing versions.

>From http://static.springframework.org/spring/docs/2.5.x/reference/testing.html
  "8.2 One of the main benefits of Dependency Injection is that your
code should really depend far less on the container than in
traditional J2EE development. The POJOs that comprise your application
should be testable in JUnit or TestNG tests, with objects simply
instantiated using the new operator, /without Spring or any other
container/." (emphasis not mine!)

Endre.

On Wed, Mar 25, 2009 at 10:50, Daniel <[email protected]> wrote:
>
> One of the main points of DI is testability, but the point of using a
> DI framework is to remove the need to write lots of factory code.
> That's the reason I use guice it anyway.
>
> Dan.
>
> On Mar 25, 2:41 am, "Dhanji R. Prasanna" <[email protected]> wrote:
>> On Wed, Mar 25, 2009 at 12:41 PM, Brian Pontarelli 
>> <[email protected]>wrote:
>>
>> > Someone still has to create the classes and wire everything together.
>> > Duck-typing doesn't really help or hurt.
>>
>> That's no pain at all since everything is mockable in Ruby without
>> interfaces or constructor separation. You can even redefine classes on the
>> fly for test cases. The main point of dependency injection is testability,
>> the rest is... well, nice, but not really germane to the the design pattern.
>>
>> Dhanji.
> >
>

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