Inversion of control

The term "inversion" is historical: a software architecture with this design "inverts" control as compared to procedural programming.

Inversion of control makes the framework extensible by the methods defined by the application programmer.

The phrase "inversion of control" has separately also come to be used in the community of Java programmers to refer specifically to the patterns of dependency injection (passing to objects the services they need) that occur with "IoC containers" in Java frameworks such as the Spring Framework.

In the mail client example, the framework could follow both the keyboard and mouse inputs and call the command invoked by the user by either means and at the same time monitor the network interface to find out if new messages arrive and refresh the screen when some network activity is detected.

Conversely, the framework knows nothing about Web browsers, spreadsheets, or text editors; implementing their functionality takes custom code.

Callbacks, schedulers, event loops, and the template method are examples of design patterns that follow the inversion of control principle, although the term is most commonly used in the context of object-oriented programming.

The term was used by Michael Mattsson in a thesis (with its original meaning of a framework calling application code instead of vice versa)[9] and was then taken from there[10] by Stefano Mazzocchi and popularized by him in 1999 in a defunct Apache Software Foundation project, Avalon, in which it referred to a parent object passing in a child object's dependencies in addition to controlling execution flow.

Which particular object will satisfy the dependency during program execution typically cannot be known at compile time using static analysis.