Dependency Injection Smells

Speakers: 

With the rise of dependency injection (DI) containers it is now very easy to keep track of all the dependencies of your classes and to switch between implementations. The temptation of using the new operator has since become much smaller. Still, a quick dive in existing code bases often reveals some bad dependency injection design practices.

In this talk I will describe a couple of these very recognizable Dependency Injection Smells. After showing a code fragment which contains one of these DI smells, I will continue to work out different scenarios in which the situation gets out of hand: the code becomes difficult to work with. Then I propose a solution based on famous design patterns like the Factory pattern and design principles like the Dependency Inversion Principle.

Schedule info
Track: 
Coding and Development
Experience level: 
Intermediate
Drupal Version: 
N/A