DIP
The DIP states that one should depend upon abstractions. Do not depend upon concretions. In other words, high-level modules should be decoupled from low-level modules through abstractions. This principle states that code should be structured around the problem domain, and the domain should declare dependencies on required infrastructure as protocols. Dependencies thus point inward to the domain model.
The reason that this principle is an inversion is because typical architectures promoted by OOP (via layer architecture) exhibit dependency graphs, where high-level modules consume low-level modules directly.
Initially, this dependency graph seems natural as, in expressing domain models in code, one inevitably depends upon the constructs ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access