知识卡片

结构图卡 · 1973.ah.1.g

渐进收拢聚合边界

理解等级:中级

从活动记录走向领域模型,先识别可不可变封装的值对象及相关行为,再把公开setter收为私有,借编译错误找出散落的状态修改逻辑并移入对象。之后按业务真正需要的最小强一致范围拆分聚合,只用ID引用外部聚合,最后确定根作为唯一公开入口。不要把既有对象层级直接当聚合。

结构图:

flowchart TD
 A[识别值对象] --> B[私有化状态修改]
 B --> C[收拢业务行为]
 C --> D[按最小强一致范围拆聚合]
 D --> E[确定根与公开入口]
这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 演进设计决策 · 查看原书依据

      Start by identifying value objects. What data structures can be modeled as immutable objects? Look for the related business logic, and make it a part of the value objects as well. Next, analyze the data structures and look for transactional boundaries. To ensure that all state-modifying logic is explicit, make all of the active records’

    参考来源

    - 位置:《Learning Domain-Driven Design》第11章《演进设计决策》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Learning Domain-Driven Design/_epub-src/OEBPS/ch11.html) - 结论依据:原文给出私有setter定位外部修改的Player示例,随后强调最小事务范围、外部ID引用和聚合根。 - 原始内容:Start by identifying value objects. What data structures can be modeled as immutable objects? Look for the related business logic, and make it a part of the value objects as well. Next, analyze the data structures and look for transactional boundaries. To ensure that all state-modifying logic is explicit, make all of the active records’