依赖倒置原则
定义
High level modules should not depend upon low level modules.Both should depend upon abstractions.Abstractions should not depend upon details.Details should depend upon abstractions.
翻译上面的话有一下三层含义:
- 高层模块不应该依赖底层模块,两者都应该依赖其抽象
- 抽象不应该依赖其细节
- 细节应该依赖抽象