G.Dependency Inversion Principle (DIP)
Summary
Both High level and low level modules should be dependent on a common abstraction or interface
Usually most of class diagrams are designed from top to bottom and but there is an OO principle “Be dependent on abstraction instead of concrete classes” that reverse this diagram and that is called dependency inversion.
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.
Applicability
Interface Design
Example
Pizaa Store Design
Related Concepts
Inversion of Control (IOC) : A Design Guidelines that further augment DIP
Dependency Injection : One of the approach to achieve IOC
Service Locators : Another approach to achieve IOC
Factory Pattern : A design pattern that implement IOC
References