From the course: Advanced Design Patterns: Design Principles

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Dependency inversion principle

Dependency inversion principle

- [Instructor] The dependency inversion principle gives us guidance to not design our high-level modules to depend on our low-level modules. But that sounds counterintuitive, because it advises us to think about designs in a manner that's really the opposite of what we're used to. We're used to thinking about designs as top-down decompositions. We take a problem, and we factor it into a high-level set of components that depend on a low-level set of components. We often think of the high-level components as some kind of policymakers that are commanding a set of low-level components, who are really carrying out all the real work. The problem with this approach is that it typically tightly couples our high-level components to our low-level ones. A symptom of this tight coupling is that it's often difficult to take that high-level component and then to go reuse it with a totally different underlying implementation of the…

Contents