Dependency Inversion principle

The last of the SOLID principles is based on two statements, that Wikipedia states in this form:

  • High-level modules should not depend on low-level modules. Both should depend on abstractions.
  • Abstractions should not depend upon details. Details should depend upon abstractions.

As for the first statement, we should clarify what we understand by high-level and low-level modules. The terminology is related to the importance of the actions performed by the module.

Let's put it simply: if a module holds the business logic of a Customers class, and another includes the format that a list of the Customers class uses in a report, the first one would be high-class and the second would be low-class.

The second statement speaks ...

Get Mastering C# and .NET Framework now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.