定义: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.
定义的含义:
a. 高层模块不应依赖低层模块,两者应都依赖其抽象
b. 抽象不应依赖细节
c. 细节应依赖抽象
(细节即实现类,抽象即接口或抽象类)
在Java中的表现:
a. 模块间的依赖通过抽象发生,实现类之间不发生直接的依赖关系,其依赖关系是通过接口或抽象类产生的
b. 接口或抽象类不依赖于实现类
c. 实现类依赖接口或抽象类
用更加精简的定义就是:
面向接口编程——OOD(Object-Oriented-Design, 面向对象设计)的精髓之一。