About
Inversion of Control (IoC) is a design pattern that addresses a component’s:
- configuration
It suggests that the control of those three component should not be the concern of the component itself. Thus it is inverted back
The most significant aspect to IoC is dependency resolution. Dependency mis-management is acknowledged to be the biggest problem that IoC is trying to solve.
The control of the program is inverted when the control is moved away from the component (ie a web forms for instance) to a framework.
In software engineering, inversion of control (IoC) describes a design in which the written code receive the flow of control from the reusable library.
A software architecture with this design inverts control as compared to traditional procedural programming:
- in traditional programming, the code calls into reusable libraries to take care of generic tasks,
- but with inversion of control, it is the reusable code that calls into the code.
The term is related to but different from the wiki/dependency inversion principle, which concerns itself with decoupling dependencies between high-level and low-level layers through shared abstractions.
Benefits
Inversion of control is used to increase modularity of the program and make it extensible
Example
A library is called by your code whereas a framework calls your code. More … What is the difference between a Library (and | vs) a Framework ?