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

来源:互联网 发布:兔展微信场景制作软件 编辑:程序博客网 时间:2024/04/30 12:13

转载自: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.

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

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

 

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




0 0
原创粉丝点击