December 11, 2008
Inversion of Control Is More Common Than You ThinkThere's a lot of confusion and huffing and puffing out there in Developerville about a very trendy and potentially job-securing term - Inversion of Control.
Inversion of Control, or IoC for short, has got to be one of the misunderstood and commonly abused terms in programming today.
"Must have experience of IoC" say the job adverts. And yesterday a perfectly capable .NET developer confessed to me that he didn't have the necessary IoC experience, and was excluding himself from a developer event because IoC was listed as one of the prerequisites.
So I would like to set the record straight: every single developer who has written any code that handles Windows or web events has experience of Inversion of Control.
IoC is a fundamental design pattern that follows what some people call the "Hollywood Principle" - don't call us, we'll call you. Whenever we write code that's invoked by a framework, like WebForms, or ASP.NET MVC, or Java servlets, we are working with IoC.
Think back to the days before things like graphical user interfaces and event-driven programming. Think back to writing command line applications where the code we wrote determined when to prompt users for input and when to call library functions in response to user input. Our application-specific code controlled the flow of execution in our programs.
In event-driven UI's, the generic windowing system (or web equivalent) calls our event handlers and invokes application logic in a user or event-determined flow of control.
The flow of control is inverted. (Well, duh!)
There. I'm glad we got that sorted.
Posted 10 years, 5 months ago on December 11, 2008