For questions about the Dependency Inversion Principle in object-oriented programming, one of the SOLID principles originated by Robert C. Martin. It states that modules should, "depend on abstractions, not concretions."
Robert Martin covered the open-closed-principle and liskov-substitution-principle in articles published in early 1996. His next article went on to discuss the implications of applying those principles to object-oriented programs.
The structure that results from rigorous use of [the OCP and the LSP] can be generalized into a principle all by itself. I call it “The Dependency Inversion Principle” (DIP).
Martin suggests that bad software design is rigid, fragile, and immobile; and these characteristics have a common cause.
What is it that makes a design rigid, fragile and immobile? It is the interdependence of the modules within that design.
The DIP seeks to alleviate this interdependence in two ways. It states.
- High-level modules should not depend upon low-level modules. Both should depend upon abstractions.
- Abstractions should not depend upon details. Details should depend upon abstractions.
Martin achieves these goals by taking traditional, procedural dependencies running from a high-level module to a low-level module and replacing them with abstractions (e.g. interfaces) that exist independently from the low-level modules which implement them.
The result of introducing abstractions that live outside of low-level modules is a reversal (i.e. inversion) to the previous direction of dependency. Rather than a dependency from high-level down to low-level modules, the low-level modules have dependencies pointing up to their abstractions.
Martin later included the DIP as the fifth of his solid-principles.
See the DIP article under Principles of OOD.