Understanding Inversion of Control
Cedric recently posted that he does not understand the value of Inversion of Control (abbreviated “IoC”, also called “Dependency Injection” by Martin Fowler).
I believe that development tools (languages, frameworks, libraries, and so on) are built for one of two reasons:
1) To solve a problem encountered by a particular developer or community.
2) For learning and experimenting.
The first case covers the creation of things like Object-Oriented programming, EJB, Hibernate, Aspect-Oriented programming, Spring, Echo, and the Ajax-related technologies. The second case explains the existence of so many dinky IM clients.
Based on these rules and my observations of community reactions to emerging technologies, I’ve concluded that developers don’t understand tools that solve problems outside of their experience. The value of a cup handle is non-obvious to a person who has never held a cup of hot liquid. To those people, the cup handle is a quaint new way to hold a cup, but they don’t “get” why it is better than holding the cup directly. To everyone who has held a cup of hot liquid directly, the value and use of the handle is immediately understood.
So rather than post yet another article explaining why IoC is a Good ThingTM, I will simply state that if you don’t get IoC, you haven’t needed IoC, and you’ll understand when the time comes.