知识卡片

普通读书笔记卡 · 1971.o.1.b.1.a.2.a.1.b.2.a.1

核心类取舍取决于关键场景而非名字

理解等级:高级

航运教学例中,Customer 看似与“满足客户要求”密切相关;但交付场景直接使用 Customer Agreement 后,通常不必进入 Customer 类,后者也较通用。Leg 则相反:原书作者倾向把它留在核心外,因为它与运输计划、路径服务和地点更内聚;若重要故事频繁涉及 Leg,也可以移入 Delivery,接受拆开旧关系的成本。

这是根据关键场景和概念内聚性做的可调整取舍,不是按“客户”“航段”等业务名词机械划边界。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 原书第15章|Segregated Core · 查看原书依据

      And what about pulling Customer out, anyway? The focus is on fulfilling the Customer's requirements, so at first Customer seems to belong in the CORE. Yet the interactions during delivery do not usually need to involve the Customer class now that the Customer Agreement is available directly. And the basic model of a Customer is pretty generic. A strong argument could be made for Leg to remain in the CORE. I tend to be minimalist in the CORE, and the Leg has tighter cohesion with Transport Schedule, Routing Service, and Location, none of which needed to be in the CORE. But if a lot of the stories I wanted to tell about this model involved Legs, I'd move it into the Delivery package and suffer the awkwardness of its separation from those other classes.

    参考来源

    - 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第123章《Segregated Core》(源文件:_epub-src/0321125215_ch15lev1sec7.html;单元03) - 结论依据:原文给出 Customer 移出核心及 Leg 是否纳入核心的相反论据,明确取决于想讲述的场景。 - 原始内容:And what about pulling Customer out, anyway? The focus is on fulfilling the Customer's requirements, so at first Customer seems to belong in the CORE. Yet the interactions during delivery do not usually need to involve the Customer class now that the Customer Agreement is available directly. And the basic model of a Customer is pretty generic. A strong argument could be made for Leg to remain in the CORE. I tend to be minimalist in the CORE, and the Leg has tighter cohesion with Transport Schedule, Routing Service, and Location, none of which needed to be in the CORE. But if a lot of the stories I wanted to tell about this model involved Legs, I'd move it into the Delivery package and suffer the awkwardness of its separation from those other classes. - 转录说明:原 EPUB 强调标签边界造成的术语前空格已规范转录;Customer 与 Leg 两段在原文中相邻。