Inversion of Control

from Wikipedia, the free encyclopedia

The term Inversion of Control ( IoC , German  reversal of control or control reversal ) describes an implementation paradigm that u. a. is used in object-oriented programming .

This paradigm describes how frameworks work : a function of an application program is registered with a standard library and called from this at a later point in time. Instead of the application controlling the control flow and only using standard functions, the control of the execution of certain subroutines is transferred to the framework.

A simple example of such a reversal are listeners (according to the observer pattern ), but Java applets and servlets also follow this design pattern . Plug-ins and callback functions are further examples of leaving the control of individual program parts to a (framework) object.

In the case of libraries that work with dependency injection (such as EJB containers or the Spring framework), you can often read about inversion of control . However, this is mainly about the creation of object networks.

See also