2. Inversion of control is a pattern used for decoupling
components and layers in the system.
It is about getting freedom, more flexibility, and
less dependency
The pattern is implemented through injecting
dependencies into a component when it is
constructed.
3. Dependency Injection is a great way to reduce
tight coupling between software components.
It’s the best way to enable loose coupling,
an important part of maintainable code.
The benefits we can reap from loose
coupling aren’t always immediately
apparent, but they become visible over
time, as the complexity of a code base
grows.
4. The greatest benefit is that it encourages
dependency free architecture. Your classes stand
alone, and do not depend on a specific
implementation (other than it's interface and
requirements)
Continue
……
5. Code becomes more reusable, testable and
readable.
When you test something, if it has a hard coded
new in there, you can't easily replace it with a
mocked object to feed it test data. Suppose you
want to test that an object calculates a value
correctly. Feeding it test data with known values
makes it easier to test.
6. We can inject
◦ Controllers
◦ Views
◦ Constructors
◦ Filters