知识卡片
行程对象统一订舱与操作接口
原书货运示例中,路由服务原本直接把每段航程写入订舱表;行程报表另行拼接这些数据。把 Itinerary 显化后,路由服务返回行程,订舱应用负责保存,订舱报表和操作支持应用共用它;Leg 从船舶航次计划推导装卸时间。这样,路由服务接口表达业务结果,并解除它对订舱表结构的依赖。书中以约一周重构展开示例叙述,不能据此当作实测工期。参见[[业务词与设计缺席是概念线索]]。
结构图:
classDiagram
class RoutingService
class Itinerary
class Leg
class VesselVoyage
RoutingService ..> Itinerary : 返回
Itinerary "1" *-- "1..*" Leg
Leg --> VesselVoyage : 从计划推导时间
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 原书第09章|Digging Out Concepts · 查看原书依据
True, all the data was already being collected, and the behavior was implicit in the itinerary report, but the explicit Itinerary as part of the model opened up opportunities.
参考来源
- 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第69章《Digging Out Concepts》,Example Hearing a Missing Concept in the Shipping Model,图9.1–9.3(源文件:_epub-src/0321125215_ch09lev1sec1.html)
- 结论依据:原文列出显化 Itinerary 后的服务接口、数据库解耦、应用共享、时间推导和领域逻辑回收。
- 原始内容:True, all the data was already being collected, and the behavior was implicit in the itinerary report, but the explicit Itinerary as part of the model opened up opportunities. Benefits of refactoring to the explicit Itinerary object: Defining the interface of the Routing Service more expressively Decoupling the Routing Service from the booking database tables Clarifying the relationship between the booking application and the operations support application (the sharing of the Itinerary object) Reducing duplication, because the Itinerary derives loading/unloading times for both the booking report and the operations support application Removing domain logic from the booking report and placing it in the isolated domain layer Expanding the UBIQUITOUS LANGUAGE , allowing a more precise discussion of the model and design between developers and domain experts and among the developers themselves. (原 EPUB 为无句号的列表项,此处用空格连接转录,末尾句号为转录补标。)
- 情节证据:原书对话中开发者说 `I'll make the routing engine just return an Itinerary . Then it can be saved in the database by the booking application when the rest of the booking is saved.`;后文写 `They did it in a series of two or three refactorings, but in quick succession, within a week, except for simplifying the itinerary report in the booking application, which they took care of early the following week.`