A revaluation of our practices and patterns happens every few years, and it seems to happen again today. The usual result is that a reaction to the existing practices results into other practices who have more or different sets of problems. One of the goals of this channel is to help avoid the loss of the useful practices by explaining why and how they are supposed to be used – rather than how they are misused or overused.
This time it’s dependency injection’s (DI) turn. A very useful pattern for automated testing and introducing change with minimal code modification, DI has been overused, or we can even say abused, through DI libraries and then big frameworks such as Swing. But that doesn’t mean that DI is a bad pattern; it just means that we need to use it in the extension points of our components.
In this video Alex explains what are the types of DI, their different semantics, and when to use DI properly.