通过应用依赖倒置,模块能够用修改依赖模块的方式简单的被其他模块修改。
By applying the dependency Inversion the modules can be easily changed by other modules just changing the dependency module.
图6显示了将JarProject作为每个模块的依赖项添加之后,mybinary . jar被自动复制到每个模块的备份EAR项目中。
Figure 6 shows the automatic copying of mybinary.jar to each module's backing EAR project after JarProject is added as a dependent of each module.
高层不应该依赖底层模块,两者应该抽象(无法被实例话的接口,类啥的);抽象不应该依赖细节;细节应该反而依赖抽象,换句话说也就是面向接口编程。
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.
应用推荐