in a Commandline driven sequential program, where the user inputs data and program processes those inputs, I control when these methods are called. but in the window example I don’t. Instead I hand control over to the windowing system.
It then decides when to call my methods, based on the bindings I made when creating the form. The control is inverted – it calls me rather me calling the framework. This phenomenon is Inversion of Control (also known as the Hollywood Principle – “Don’t call us, we’ll call you”). – more here
- the term Inversion of Control first came to light in Johnson and Foote’s paper Designing Reusable Classes
- John Vlissides wrote a column for C++ report that provides a good explanation of the concept under the ‘Hollywood Principle’