知识卡片

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

订舱接受规则应由领域服务判断

理解等级:中级

原书图7.10仍让 Booking Application 比较“某细分已分配额度”与“已订数量+新货量”,这使应用层承担业务规则,且细分由谁推导也不清楚。图7.11把推导 Cargo 的 Enterprise Segment 和判断可否接受交给 Allocation Checker;应用层只协调仓储取已订数量,再调用领域服务。这里是原书的责任重划,不代表任何订舱场景都只靠这一个规则。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 原书第07章|Introducing a New Feature: Allocation Checking · 查看原书依据

      We have given the Booking Application the job of applying this rule: "A Cargo is accepted if the space allocated for its Enterprise Segment is greater than the quantity already booked plus the size of the new Cargo." Enforcing a business rule is domain responsibility and shouldn't be performed in the application layer. It isn't clear how the Booking Application derives the Enterprise Segment. Both of these responsibilities seem to belong to the Allocation Checker.

    参考来源

    - 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第59章《原书第07章|Introducing a New Feature: Allocation Checking》(源文件:_epub-src/0321125215_ch07lev1sec11.html;图7.10–7.11) - 结论依据:原文明确指出接受规则是领域责任,不应由 Booking Application 执行,并把两个职责转交检查器。 - 原始内容:We have given the Booking Application the job of applying this rule: "A Cargo is accepted if the space allocated for its Enterprise Segment is greater than the quantity already booked plus the size of the new Cargo ." Enforcing a business rule is domain responsibility and shouldn't be performed in the application layer. It isn't clear how the Booking Application derives the Enterprise Segment . Both of these responsibilities seem to belong to the Allocation Checker .