News for hackers. Stuff that matters.
Re:Why Most Unit Testing is Waste (2014) [pdf] by will_hughes on Monday May 30, 2016 @01:39AM (#11799757)
> The benefits are being able to have multiple targets for an interface, and being able to more cleanly unit test some systems in a strongly typed compiled language.

The benefit for DI/IOC for me is mainly not having to worry about how to compose the system.

If some new module I'm writing needs a particular dependency, then I just ask for that in my constructor.

I neither need to know nor care how to set it up or initialise it. That's taken care of by the container - either automatically (convention based registration) or by the maintainer of FooService.

This makes it dead easy to create smaller integration/test harnesses: run the normal container build step, and then resolve an instance of my class, out it pops with all the dependencies handled.

There are no comments on this comment yet.