软件开发原则之依赖倒置原则

转载自:http://www.jianzhanseo.com/?p=449


依赖倒置原则(dependence inversion principle DIP)

定义:Hight 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.

翻译一下意思是:高层模块不应该依赖低层模块。二者应该都依赖抽象模块。抽象模块不应该依赖细节。细节应该依赖抽象。

概括成一句话就是:高层模块、低层模块、细节都只应该依赖抽象层。

 

好,那么什么是高层模块,低层模块,什么是抽象和细节呢?




猜你喜欢

转载自blog.csdn.net/caiyiii/article/details/20489127