Fowler brands IoC “Dependency Injection”
by Kevin Dangoor
Martin Fowler provides a good dissection of the current lightweight container hullabaloo. He’s promoting the term “Dependency Injection” over “Inversion of Control”, because IoC is a bit generic for the pattern. The article also contrasts Dependency Injection with the Service Locator pattern, and does a nice job of list the pros and cons of each approach.
For Dependency Injection, he ultimately sides with PicoContainer’s constructor injection approach, admitting that ThoughtWorks folks are involved in PicoContainer’s development. I agree with his reason, though: you can use your constructors to ensure that your objects are always valid, even upon initial creation.
Any decent-sized, loosely-coupled system is going to run into the types of issues solved by these patterns. This article is a nice treatment of the topic.
Heh.
When I first read “IoC” I pulled the other l/Ii/1 variable mistake and thought it was “Lines of Code”…but hopefully everyones forgotton about that metric by now.
I once joked that people should be graded on how few lines of code it takes to implement some functionality. (Just a joke!!! I know that to actually do such a thing would yield hideously unreadable and unmaintainable code!)