← 返回起始笔记位置

知识卡片

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

处理事件因独立查询成为聚合根

理解等级:中级

货运案例中 Delivery History 只随所属 Cargo 被访问,且借货物身份,可放进 Cargo 聚合;Delivery Specification 是值对象,也可纳入。Handling Event 虽为某件货物产生,却还可能按 Carrier Movement 独立查询装载与准备操作,因此原书图7.3把它设为另一聚合根。边界取决于对象是否需脱离货物单独访问,而非只看“为谁创建”。当前首版尚无这项查询需求,是否提供仓储另作判断。参见[[聚合根限定外部引用]]。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第53章《原书第07章|Aggregate Boundaries》(源文件:_epub-src/0321125215_ch07lev1sec5.html;图7.3) - 结论依据:原文先把交付历史与规格纳入 Cargo 聚合,再因 Handling Event 可按 Carrier Movement 独立查询而将其设为自己的聚合根。 - 原始内容:With no need for direct global access, and with an identity that is really just derived from the Cargo , the Delivery History fits nicely inside Cargo's boundary, and it does not need to be a root. ... So the Handling Event should be the root of its own AGGREGATE .