Glossary · Automation software engineering and architecture
Inversion of control
Also known as: IoC
German: Umkehrung der Steuerung
In software engineering, inversion of control is a design principle in which the flow of control or the provision of dependencies is handed from a component to a framework or container, which calls the component's code when needed instead of the component calling the framework.
- Software engineering
In one sentence
Inversion of control hands program flow or dependency provision to a framework, which calls the component's code when needed.
Example
The PLC runtime calls the application's cyclic program every 10 ms; the program does not control when it runs, a classic case of inversion of control.
How it applies
- Engineering: Frameworks apply inversion of control through callbacks, event handlers, lifecycle methods and Dependency injection. The component focuses on its logic; the framework decides when to call it and supplies what it needs.
- Automation context: PLC runtimes, IEC 61499 runtimes and HMI frameworks are all built on this principle: user code is called by the runtime's task scheduler or event system.
- Documentation: Framework documentation must explain the call order and lifecycle: when components are initialized, called cyclically, notified of events and shut down. Without this, developers make wrong assumptions about timing and state.
Inversion of control vs. dependency injection
Inversion of control is the general principle; dependency injection is one form of it, concerned with supplying dependencies. Callback-based designs and event-driven frameworks are other forms. The more control is inverted, the harder it can be to follow program flow when troubleshooting.