You get a bonus - 1 coin for daily activity. Now you have 1 coin

Inversion Control - Inversion of Control (IoC)

Lecture



Inversion of control (English Inversion of Control , IoC ) is an important principle of object-oriented programming used to reduce gearing in computer programs [1]. Also, an architectural integration solution that simplifies the expansion of system capabilities, in which control over the program’s control flow remains behind the framework [2].


One of the implementations of IoC as applied to dependency management is dependency injection (eng. Dependency injection ) [2] [3]. Dependency injection is used in many frameworks called IoC containers.

When compared with lower-level technologies, an IoC container is a linker that collects OOP objects (class instances) rather than object files during program execution. Obviously, to implement such an idea, it was necessary to create not only the linker, but also the factory that produces the objects. The analogue of such a linker (naturally, more functional) is the compiler, one of the functions of which is the creation of object files. There is nothing new about the idea of ​​linking the program during execution. Providing the programmer with the tools to implement dependencies gave much more flexibility in development and convenience in testing the code [4].

Content

  • 1Application methods
  • 2 Criticism
  • 3Notes
  • 4 Literature
  • 5Links

Implementation methods

  • Template "Factory" (eng. Factory pattern )
  • Service locator (English) Russian.
  • Dependency injection (Eng. Dependency injection )
    • Through the designer (English Constructor injection )
    • Through the class method (English Setter injection )
    • Through the injection interface (eng. Interface injection )
  • Contextual search (born contextualized lookup )

Criticism

All approaches based on inversion of control suffer from the following two disadvantages [5]:

  • the program interaction logic is scattered across individual event handlers or classes;
  • control flow is implicitly specified and uses the shared state of event handlers.

Comments


To leave a comment
If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Object oriented programming

Terms: Object oriented programming