Fowler brands IoC “Dependency Injection”

Jan 14, 2004 21:01 · 125 words · 1 minute read

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.