Dependency inversion principle
From Wiki @ Karl Jones dot com
Revision as of 13:28, 20 September 2016 by Karl Jones (Talk | contribs) (Created page with "In object-oriented programming, the '''dependency inversion principle''' refers to a specific form of decoupling software Modular pro...")
In object-oriented programming, the dependency inversion principle refers to a specific form of decoupling software modules.
Description
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. The principle states:
- A. High-level modules should not depend on low-level modules. Both should depend on abstractions.
- B. Abstractions should not depend on details. Details should depend on abstractions.
The principle inverts the way some people may think about object-oriented design, dictating that both high- and low-level objects must depend on the same abstraction.
See also
- Abstraction (software engineering)
- Adapter pattern
- Coupling (computer programming)
- Creational pattern
- Dependency Injection
- Design by contract
- Interface
- Inversion of Control
- Modular programming
- Object-oriented programming
- Plug-in (computing)
- Service locator pattern
- SOLID – the "D" in "SOLID" stands for the dependency inversion principle
External links
- Dependency inversion principle @ Wikipedia