Inversion of control (IoC)
Inversion of control (IoC) is a design principle in which the control flow of a program is somehow inverted.
In traditional programming, the main program is in control of the flow of the program. In IoC, the flow is inverted, and the control is given to a framework or runtime environment. The Spring Framework is a well-known IoC container for Java applications.
Various design patterns can be used to implement IoC, such as the dependency injection and publish-subscribe patterns. Dependency inversion is one principle that IoC puts into practice by inverting the direction of dependencies between modules.
See also
- Inversion of Control Containers and the Dependency Injection Pattern, Martin Fowler, 2004.
- Service Locator vs Dependency Injection Container (or Tell, Don’t Ask Part 2), Adam Brett, 2013
- Why use a Dependency Injection Container?, Richard Miller, 2011