Difference between revisions of "Dependency Inversion Principle"
From JholJhapata
(Created page with "The Dependency Inversion Principle states that: # High-level modules should not depend on low-level modules. Both should depend on abstractions. # Abstractions should not depe...") |
|||
| Line 5: | Line 5: | ||
Dependency inversion principle is one on which most of the design patterns are build upon. It's aim is to reduce the coupling between the classes is achieved by introducing abstraction between the layer, thus doesn’t care about the real implementation. | Dependency inversion principle is one on which most of the design patterns are build upon. It's aim is to reduce the coupling between the classes is achieved by introducing abstraction between the layer, thus doesn’t care about the real implementation. | ||
== Dependency Inversion Principle Example == | == Dependency Inversion Principle Example == | ||
| + | |||
| + | === Violating Dependency Inversion Principle === | ||
| + | [[File:Violating Dependency Inversion Principle.png|thumb|Violating Dependency Inversion Principle]] | ||
| + | === Dependency Inversion Principle Example === | ||
| + | [[File:Dependency_Inversion_Principle.png|thumb|Dependency Inversion Principle]] | ||
Revision as of 15:39, 24 August 2019
The Dependency Inversion Principle states that:
- 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.
Dependency inversion principle is one on which most of the design patterns are build upon. It's aim is to reduce the coupling between the classes is achieved by introducing abstraction between the layer, thus doesn’t care about the real implementation.