知识卡片

普通读书笔记卡 · 1971.o.1.b.4.e.1.c

关联遍历方向服从业务任务

理解等级:中级

原书货运案例不把概念图中的关联都做成双向引用:长期重复交易的 Customer 若持有全部 Cargo 会很笨重,需要时可按客户查询货物;系统只跟踪货物,不盘点船舶,因此让 Handling Event 指向 Carrier Movement 即可。图7.2的箭头表达当前业务关注点,也减少无用的反向集合维护。若业务改为盘点船舶,方向应重评。参见[[搜索与关联遍历共同设计对象入口]]。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第52章《原书第07章|Designing Associations in the Shipping Domain》(源文件:_epub-src/0321125215_ch07lev1sec4.html;图7.2) - 结论依据:原文分别说明 Customer 不宜持有所有货物,以及系统只需跟踪 Cargo,因此 Handling Event 到 Carrier Movement 的单向遍历已足够。 - 原始内容:If the Customer has a direct reference to every Cargo it has shipped, it will become cumbersome for long-term, repeat Customers . ... But our business needs to track only the Cargo . Making the association traversable only from Handling Event to Carrier Movement captures that understanding of our business.