← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 2304.g.1

拆职责可减局部耦合

理解等级:高级

组件A被20个组件使用,未必每个使用方都需要A全部功能。若14个只依赖一小块,把该块拆为A1后,主体A2可能只剩6个入向依赖。需要追到真实职责和调用用途,才能让主体更独立;仅把文件搬进新目录却保留同一组调用,不会产生该收益。

相关:[[组件依赖图估计拆分难度]]。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 基于组件的分解模式 · 查看原书依据

      This does not necessarily mean that all 20 of the other components require all of the functionality from component A. Maybe 14 of the other components require only a small part of the functionality contained in component A. Breaking component A into two different components (component A1 containing the smaller, coupled functionality, and component A2 containing the majority of the functionality) reduces the afferent coupling in component A2 to 6, with component A1 having an afferent coupling level of 14.

    参考来源

    - 位置:《Software Architecture: The Hard Parts》第5章《基于组件的分解模式》(来源项目:book-sources;源文件:extracted/Software Architecture The Hard Parts Modern Trade-Off Analyses for Distributed Architectures (Neal Ford, Mark Richards, Pramod Sadalage etc.)/_epub-src/OEBPS/ch05.xhtml) - 结论依据:原文的定义、比较或案例支持“组件A被20个组件使用,未必每个使用方都需要A全部功能”;正文据此解释其用途与适用边界。 - 原始内容:This does not necessarily mean that all 20 of the other components require all of the functionality from component A. Maybe 14 of the other components require only a small part of the functionality contained in component A. Breaking component A into two different components (component A1 containing the smaller, coupled functionality, and component A2 containing the majority of the functionality) reduces the afferent coupling in component A2 to 6, with component A1 having an afferent coupling level of 14.