Dependency Injection Principle (DIP) - Inversion of Control (IoC)
The principle states:
- High-level modules should not depend on low-level modules. Both should depend on abstractions.
- Abstractions should not depend on details. Details should depend on abstractions.
The first point suggests we apply two things at the same time to the codes:
- Abstraction (e.g. Interfaces, Abstract Classes, etc)
- Dependency Inversion or Inversion of Control (e.g. passing dependencies through constructor args)