Inversion of Control (IoC)

Inversion of Control, or IoC, is an abstract principle describing an aspect of some software architecture designs in which the flow of control of a system is inverted in comparison to procedural programming.

Saw IoC many times in many technical articles especially with the topics of Object-oriented design or software engineering development. However, I have no fully understand what IoC is talking about at the first pace. Therefore, I had carried out a research about this.

To understand this, let take a scenario.

Consider we have a framework, and application that runs on the framework.

In traditional aspects, application calls required libraries or API to carry out their tasks. The central control is held by central piece of code in application. In Inversion of Control, framework  actively calls application to carry out tasks. It often using inheritance to realize IoC. Parent class actively calls the method from child class. Framework lets relevant parent classes work together to define the process of the tasks. At the meantime, parent class leave interface, or in Java Term, abstract method, to be implemented by child classes.

The advantage of Inversion of Control is that there is decoupling of the execution of a certain task from implementation. Secondly, it enables less hassles in system replacement.

Further reading:

Author: fyhao

Jebsen & Jessen Comms Singapore INTI University College Bsc (Hon) of Computer Science, Coventry University

Leave a Reply