The Dependency Inversion Principle (DIP)

The principle focuses on the following two parts:

  • 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.

First of all, what is a high-level module and a low-level module? In short, high-level modules contain business rules, and low-level modules contain the implementation details.

According to the first part of this principle, high-level modules should only be concerned with high-level abstraction. This high-level abstraction defines what the components are, what the interactions between these components are, and what business rules these components must follow. Low-level modules ...

Get Building Applications with Spring 5 and Vue.js 2 now with O’Reilly online learning.

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