知识卡片

普通读书笔记卡 · 1971.o.1.b.1.a.2.a.1.e

内聚机制将求解细节从领域表达中分离

理解等级:高级

当大量算法方法淹没“要解决什么”时,先寻找能使计算变简单的更深领域模型。若其中有概念上内聚的计算,再抽为聚焦的轻量框架,用意图清晰的接口向领域模型提供能力。

领域模型陈述事实、规则与问题,机制负责按模型指定的方式计算。机制不是吞下所有复杂计算的通用“计算器”;它的范围取决于一组可辨认的形式化问题。这样核心领域能以较声明式的方式表达意图。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第122章《Cohesive Mechanisms》(源文件:_epub-src/0321125215_ch15lev1sec6.html;单元01) - 结论依据:原文先要求寻找简化计算的模型,再建议提取概念上内聚的部分,明确排除包罗万象的计算器。 - 原始内容:This proliferation of procedures is a symptom of a problem in the model. Refactoring toward deeper insight can yield a model and design whose elements are better suited to solving the problem. The first solution to seek is a model that makes the computation mechanism simple. But now and then the insight emerges that some part of the mechanism is itself conceptually coherent. This conceptual computation will probably not include all of the messy computations you need. We are not talking about some kind of catch-all "calculator." But extracting the coherent part should make the remaining mechanism easier to understand. [...] Partition a conceptually COHESIVE MECHANISM into a separate lightweight framework. Particularly watch for formalisms or well-documented categories of algorithms. Expose the capabilities of the framework with an INTENTION-REVEALING INTERFACE. - 转录说明:`[...]` 标明模式陈述前的过渡省略。