摘要: 依赖倒置原则(The Dependency Inversion Principle)可表述为 “高层模块不应该依赖于低层模块,二者都应该依赖于抽象。抽象不应该依赖于具体实现细节,而具体实现细节应该依赖于抽象。(A. High level modules should not depend upon low level modules. Both should depend upon abstractions. B.Abstractions should not depend upon details. Details should depend upon abstraction.)”。DIP 是很多面向对象技术的根基。它特别适合应用于构建可复用的软件框架。其对于构建弹性地易于变化的代码也特别重要。并且,因为抽象和细节已经彼此隔离,代码也变得更易维护。 阅读全文
posted @ 2014-06-19 11:25 sangmado 阅读(10305) 评论(3) 推荐(6) 编辑