知识卡片
转移子域责任可替代共享内核
若两个模型中有一个明显更适合承担某子域,可把该子域的全部责任逐步转给偏好的上下文,应用改为调用它,并在该模型中补齐功能。这样消除重复,却不承担持续维护共享内核的协作成本。
转移期可能很长,甚至无限延续;它保留分开建模的得失,也不保证最后会完全合并。是否采用,应比较责任转移与[[共享内核只共享双方必需的模型子集]]的成本。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 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.