← 返回刚才阅读的位置

知识卡片

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

转移子域责任可替代共享内核

理解等级:高级

若两个模型中有一个明显更适合承担某子域,可把该子域的全部责任逐步转给偏好的上下文,应用改为调用它,并在该模型中补齐功能。这样消除重复,却不承担持续维护共享内核的协作成本。

转移期可能很长,甚至无限延续;它保留分开建模的得失,也不保证最后会完全合并。是否采用,应比较责任转移与[[共享内核只共享双方必需的模型子集]]的成本。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 原书第14章|Transformations · 查看原书依据

      If one of the two models is definitely preferred, consider shifting toward it without integrating. Instead of sharing common subdomains, just systematically transfer full responsibility for those subdomains from one BOUNDED CONTEXT to the other by refactoring the applications to call on the model of the more favored CONTEXT, and making any enhancements that model needs. Without any ongoing integration overhead, you have eliminated redundancy. Potentially (but not necessarily), the more favored BOUNDED CONTEXT could eventually take over completely, and you'll have created the same effect as a merger. In the transition (which can be quite long or indefinite), this will have the usual advantages and disadvantages of going SEPARATE WAYS, and you have to weigh them against the pros and cons of a SHARED KERNEL.

    参考来源

    - 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第115章《Transformations》(源文件:_epub-src/0321125215_ch14lev1sec14.html;单元02) - 结论依据:原文在共享内核方案之后提出另一条路线:逐步把完整子域责任迁往优选上下文,而非共用子域。 - 原始内容:If one of the two models is definitely preferred, consider shifting toward it without integrating. Instead of sharing common subdomains, just systematically transfer full responsibility for those subdomains from one BOUNDED CONTEXT to the other by refactoring the applications to call on the model of the more favored CONTEXT , and making any enhancements that model needs. Without any ongoing integration overhead, you have eliminated redundancy. Potentially (but not necessarily), the more favored BOUNDED CONTEXT could eventually take over completely, and you'll have created the same effect as a merger. In the transition (which can be quite long or indefinite), this will have the usual advantages and disadvantages of going SEPARATE WAYS , and you have to weigh them against the pros and cons of a SHARED KERNEL .