Welcome to Shaun Luttin's public notebook. It contains rough, practical notes. The guiding idea is that, despite what marketing tells us, there are no experts at anything. Sharing our half-baked ideas helps everyone. We're all just muddling thru. Find out more about our work at bigfont.ca.
Dependency injection is valuable in languages that lack inheritance and becomes more powerful in languages that have inheritance.
Without inheritance, dependency injection lets the container control constructor arguments. "Resolve for me an object of type
Carrotand use whatever constructor arguments you would like when creating that object."
With inheritance, dependency injection lets the container also control implementation. "Resolve for me an object of type
IVegetableand use whatever implementation and/or constructor arguments you would like."