知识卡片
面条模块难以独立测试
参数一改就生成完全不同的服务器、容器、数据库与网络组合时,一个模块承担了过多职责。大量条件组合使理解、变更和测试都困难。可拆为职责较小的模块;动态领域抽象应选适合表达逻辑的语言,但换语言也不能替代高内聚设计。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 设计基础设施代码库 · 查看原书依据
A module that does too many things is less maintainable than one with a tighter scope. The more things a module does, and the more variations that exist in the infrastructure that it can create, the harder it is to change it without breaking something. These modules are harder to test. Better-designed code is easier
参考来源
- 位置:《Infrastructure As Code》第10章《设计基础设施代码库》(来源项目:book-sources;源文件:extracted/Infrastructure As Code/_epub-src/OEBPS/ch10.html)
- 结论依据:原文说明参数一改就生成完全不同的服务器、容器、数据库与网络组合时,一个模块承担了过多职责;本卡据此解释其用途及适用边界。
- 原始内容:A module that does too many things is less maintainable than one with a tighter scope. The more things a module does, and the more variations that exist in the infrastructure that it can create, the harder it is to change it without breaking something. These modules are harder to test. Better-designed code is easier