知识卡片

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

概念轮廓决定拆分粒度

理解等级:高级

“概念轮廓”是领域中有意义的职责边界。拆操作、接口和对象时,先找能独立表达的完整概念,再用高内聚、低耦合及反复变化的方向校准边界;固定地拆细、合大或统一粒度都可能失真。

原书教学例子:若两个对象相加在领域中是一个完整动作,add() 就不必拆成两步或包进后续动作。颜料店用户混合的是完整油漆;只有设备允许直接加单色颜料,或服务对象改为化学师时,才需要更细模型。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 原书第10章|Conceptual Contours · 查看原书依据

      Find the conceptually meaningful unit of functionality, and the resulting design will be both flexible and understandable. For example, if an "addition" of two objects has a coherent meaning in the domain, then implement methods at that level. Don't break the add() into two steps. Don't proceed to the next step within the same operation.

    参考来源

    - 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第76章《Conceptual Contours》(源文件:_epub-src/0321125215_ch10lev1sec4.html;单元01) - 结论依据:原文直接否定固定粒度规则,提出有意义的功能单元,并以加法与颜料混合说明边界随服务对象和业务操作改变。 - 原始内容:Find the conceptually meaningful unit of functionality, and the resulting design will be both flexible and understandable. For example, if an "addition" of two objects has a coherent meaning in the domain, then implement methods at that level. Don't break the add() into two steps. Don't proceed to the next step within the same operation.