Skip to main content

Posts

Showing posts from May 20, 2020

Dependency Inversion Principle (DIP)

D of the SOLID principle is Dependency Inversion Principle also known as DIP.

This is one of those very powerful principle to build highly-decoupled well structured software.



What is Dependency Inversion Principle? The dependency inversion principle is a specific form of decoupling software modules. When following this principle, the conventional dependency relationships established from high-level, policy-setting modules to low-level, dependency modules are reversed, thus rendering high-level modules independent of the low-level module implementation details. (wikipedia)
Depend on abstractions, not on concretions.
Robert C. Martin’s definition of the Dependency Inversion Principle consists of 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.



The idea here is that high-level module should not depend on low-level modules. Both should only depend on the a…