课程: Advanced Design Patterns: Design Principles
免费学习该课程!
今天就开通帐号,24,700 门业界名师课程任您挑!
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…
内容
-
-
-
Encapsulate what varies5 分钟 41 秒
-
(已锁定)
Favor composition over inheritance4 分钟 5 秒
-
(已锁定)
Loose coupling4 分钟 42 秒
-
(已锁定)
Program to interfaces4 分钟 47 秒
-
(已锁定)
Single responsibility principle5 分钟 5 秒
-
(已锁定)
Open-closed principle3 分钟 56 秒
-
(已锁定)
Liskov's substitution principle5 分钟 37 秒
-
(已锁定)
Interface segregation principle5 分钟 29 秒
-
(已锁定)
Dependency inversion principle4 分钟 49 秒
-
-