依赖倒置(Dependency Injection)

将原本的依赖于具体实现的状况转换成依赖于抽象。

或者说高层次的模块不应该依靠低层次模块实现,而是依靠低层次模块的抽象。

好莱坞原则:“Don’t call me; I’ll call you.”

Inversion of Control Containers and the Dependency Injection pattern》 by Martin Fowler

Comments are closed