知识卡片
耦合需要边界而非消失
耦合指组件之间共享的信息与依赖。界面、后端和数据库必须交互,因此目标不是消除所有耦合,而是限制各方知道的内部细节:界面不应依赖数据库模式,后端也不应负责界面样式。稳定、明确的通信契约可让组件改动少产生意外波及。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
原书出处
参考来源
- 位置:《Principles of Software Architecture Modernization》第1章《What’s Wrong with Monoliths?》(源文件:`_epub-src/OPS/ch01.xhtml`,归一化正文 [20775:24977))
- 结论依据:原文先定义耦合并指出其不可避免,再以界面不应知晓数据库模式等例子说明边界,随后将缺乏清晰契约与意外改动影响联系起来。
- 原始内容:Coupling could be seen as how much information and software dependencies know about each other. Coupling is not bad – it is necessary for software. Components need to be connected, your UI needs to call your backend, which needs to call your database… coupling is inevitable. But you need proper boundaries. Your UI shouldn’t know about your database schema, and your backend should not be needed to deliver properly formed CSS.