Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
DI CONTAINERS are great tools, but, as with all tools, there are correct and incorrect ways of using them. In the same way that cooks know to treat their knives with respect, so should you learn to properly wield your DI CONTAINER—it doesn’t have the potential to lop off your fingers, but you may not harvest the benefits it can provide.
The most important thing to understand is where in the application architecture a DI CONTAINER should be used. Once you understand that, you must also learn how to use it. The following two mini-patterns provide the answers.