软件设计原则依赖倒置
发布时间
阅读量:
阅读量
介绍
基于倒置原则的基本概念是指:高层组件不应直接或间接地与低层组件交互;它们都应通过接口或摘要机制进行交互;这些接口或摘要不应由具体的实现代码所决定;而具体实现的细节则由相关的接口或摘要来确定(High level components should not interact directly or indirectly with low level components; they should rely on interfaces or abstracts instead; these interfaces or abstracts should not be determined by concrete implementation code; while the specific implementation details are dictated by the relevant interfaces or abstracts)。这一理念的本质在于:强调以接口为中心的设计方法而非以实现为中心的设计方法。
好处是:
- 采用依赖倒置原则;不仅可以降低各组件之间的耦合程度;还可以增强系统稳定性。
- 采用依赖倒置原则;能够有效降低并行开发带来的风险。
全部评论 (0)
还没有任何评论哟~
