In this introductory section, we'll see what Dependency Injection is, where it comes, and how it's defined so that we can then discuss various methods to implement it, having a clear understanding of its principles.
We'll also see the benefits it brings to the software, the reasons to apply it, and when to do so.
Dependency Injection is one of the most misunderstood concepts in computer programming. This is because the Dependency Injection borders are quite blurry and they could overlap with other object-oriented programming concepts. We'll start with a uniform definition of the DI so that we can proceed without confusion.
Let's start with a formal definition:
Note
"In software engineering, Dependency Injection is a software design pattern that implements inversion of control for resolving dependencies." - Wikipedia
To be honest, this is not really clear: what is Inversion of Control? Why is it useful for resolving dependencies...