This article includes a list of general references, but it lacks sufficient corresponding inline citations. Please help to improve this article by introducing more precise citations.(September 2018) (Learn how and when to remove this message)
This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed. Find sources: "Dependency inversion principle" – news · newspapers · books · scholar · JSTOR(September 2018) (Learn how and when to remove this message)
SOLID
Principles
Single responsibility
Open–closed
Liskov substitution
Interface segregation
Dependency inversion
v
t
e
In object-oriented design, the dependency inversion principle is a specific methodology for loosely coupled 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. The principle states:[1]
High-level modules should not import anything from low-level modules. Both should depend on abstractions (e.g., interfaces).
Abstractions should not depend on details. Details (concrete implementations) should depend on abstractions.
By dictating that both high-level and low-level objects must depend on the same abstraction, this design principle inverts the way some people may think about object-oriented programming.[2]
The idea behind points A and B of this principle is that when designing the interaction between a high-level module and a low-level one, the interaction should be thought of as an abstract interaction between them. This not only has implications on the design of the high-level module, but also on the low-level one: the low-level one should be designed with the interaction in mind and it may be necessary to change its usage interface.
In many cases, thinking about the interaction in itself as an abstract concept allows the coupling of the components to be reduced without introducing additional coding patterns, allowing only a lighter and less implementation-dependent interaction schema.
When the discovered abstract interaction schema(s) between two modules is/are generic and the generalization makes sense, this design principle also leads to the following dependency inversion coding pattern.
^Martin, Robert C. (2003). Agile Software Development, Principles, Patterns, and Practices. Prentice Hall. pp. 127–131. ISBN 978-0135974445.
^Freeman, Eric; Freeman, Elisabeth; Kathy, Sierra; Bert, Bates (2004). Hendrickson, Mike; Loukides, Mike (eds.). Head First Design Patterns(paperback). Vol. 1. O'REILLY. ISBN 978-0-596-00712-6. Retrieved 2012-06-21.
and 20 Related for: Dependency inversion principle information
design, the dependencyinversionprinciple is a specific methodology for loosely coupled software modules. When following this principle, the conventional...
configurations? Dependency injection is often used to keep code in-line with the dependencyinversionprinciple. In statically typed languages using dependency injection...
In software engineering, inversion of control (IoC) is a design principle in which custom-written portions of a computer program receive the flow of control...
segregation principle: "Clients should not be forced to depend upon interfaces that they do not use." The Dependencyinversionprinciple: "Depend upon...
The acyclic dependenciesprinciple (ADP) is a software design principle defined by Robert C. Martin that states that "the dependency graph of packages...
implemented methods. This pattern is an example of enforcing the dependencyinversionprinciple. Mixins first appeared in Symbolics's object-oriented Flavors...
with a simulator. Dependency injection Dependencyinversionprinciple Java Naming and Directory Interface Fowler, Martin. "Inversion of Control Containers...
Delegation, strongly relevant to the object adapter pattern. Dependencyinversionprinciple, which can be thought of as applying the adapter pattern, when...
The Liskov substitution principle (LSP) is a particular definition of a subtyping relation, called strong behavioral subtyping, that was initially introduced...
paths of packages participating in package dependency cycles. Dependencyinversionprinciple – a method to reduce coupling (Martin 2002:127). Robert Cecil...
participate in inversion locative or temporal adverb first prepositional phrase first (see locative inversion, directive inversion) After the two latter...
explicit callbacks then results in the creation of implicit dependencies. Therefore, control inversion, which is induced via callback, is thus left in place...
one or many concrete classes. This is known as dependencyinversion. The dependent class's dependency is to a "contract" specified by the interface; a...
The free energy principle is a theoretical framework suggesting that the brain reduces surprise or uncertainty by making predictions based on internal...
of data, with systems which operate on the components. ECS follows the principle of composition over inheritance, meaning that every entity is defined...
of sentences. Dependency grammar is an approach to sentence structure in which syntactic units are arranged according to the dependency relation, as opposed...
verb, and thus no specific indication of dependency needs to be made. In the case of subject-verb inversion, a distinct link type is employed. For free...