This week's book giveaway is in the Agile and Other Processes forum. We're giving away four copies of Darcy DeClute's Scrum Master Certification Guide: The Definitive Resource for Passing the CSM and PSM Exams and have Darcy DeClute on-line! See this thread for details.
In short, IOC is generic term which includes dependency injection and dependency lookup, while dependency injection is concrete form of IOC. In most of the places they are used interchangeably. But fact is IOC is generic and DI is concrete.
To add a historical point: Inversion of Control is a general term first used to explain how OO frameworks work. Inversion of Control is often pronounced as the Hollywood principle "don't call us, we will call you". Take for example the design pattern "Template method": your code is called from the framework. This design pattern shows also the big difference in this meaning of IoC versus DI: the Template Method calls your code at a specific point in a sequence of actions done by the framework. DI as I know it is completely static, constructing a net of objects at initialization time and injecting this environment into the components which need it.
DI is clearly a form of IoC but a very special one.
Dhanji, do you agree this? (besides my crude characterization of DI)
There are many nuanced interpretations of the differences between them. As I said in my linked post above, I try to avoid IoC altogether as it tends to apply too broadly, and stick instead to DI which everyone is rather clear on (or hopefully can be convinced so!)
Software Engineer at Google
Lasagna is spaghetti flvored cake. Just like this tiny ad:
a bit of art, as a gift, the permaculture playing cards