← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 1971.o.1.c.1.f.1

整洁代码也可能暴露模型失配

理解等级:中级

深层重构的启动信号不只来自复杂、别扭的代码。即使代码整洁,若模型用语与领域专家脱节,或新需求难以自然放进模型,也可能是概念缺失或关系错误。开发者学到更多业务知识后,同样可以主动提出更清晰的模型。

先把不协调处描述成可讨论的领域问题,再与同伴、专家核对;分析模式和设计模式可以提供候选线索。不能把一次常规代码整理自动当作领域模型已经改善。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 原书第13章|Initiation · 查看原书依据

      In a departure from the conventional view of refactoring, this same realization could come when the code looks tidy, if the language of the model seems disconnected from the domain experts, or if new requirements are not fitting in naturally. Refactoring might result from learning, as a developer who has gained deeper understanding sees an opportunity for a more lucid or useful model.

    参考来源

    - 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第92章《Initiation》(源文件:_epub-src/0321125215_ch13lev1sec1.html;单元01) - 结论依据:原文列出代码复杂、模型语言与专家脱节、新需求不契合及学习带来的洞见等启动信号,随后建议共同讨论并借鉴模式。 - 原始内容:In a departure from the conventional view of refactoring, this same realization could come when the code looks tidy, if the language of the model seems disconnected from the domain experts, or if new requirements are not fitting in naturally. Refactoring might result from learning, as a developer who has gained deeper understanding sees an opportunity for a more lucid or useful model.