0
kicks
What is Inversion of control and why we need it?
Most of programmer need inversion of control pattern in today’s complex real time application world. So I have decided to write a blog post about it. This blog post will explain what is Inversion of control and why we need it. We are going to take a real world example so it would be better to understand.
The problem- Why we need inversion of control?
Before giving definition of Inversion of control let’s take a simple real word example to see why we need inversion of control. Please have look on the following code.
public class class1
{
private class2 _class2;
public class1()
{
_class2=new class2();
}
}
public class class2
{
//Some implementation of class2
}