知识卡片
跨子域交互复杂时可横向抽取抽象核心
大型核心模型按子域拆模块通常有用;若不同子域之间的大量交互必须建立许多互相引用,或被迫绕成间接调用,拆分反而会遮蔽整体关系。
原书提出“横向切分”:当跨模块互动大多能由对应领域根本概念的多态接口表达时,抽出独立的抽象核心模块。图示显示各专门模块通过上层共同抽象相连,而非彼此交错依赖。它的前提是有真实领域抽象,不能只因接口技术上可提取就这样做。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 原书第15章|Abstract Core · 查看原书依据
Consider slicing horizontally rather than vertically. Polymorphism gives us the power to ignore a lot of the detailed variation among instances of an abstract type. If most of the interactions across MODULES can be expressed at the level of polymorphic interfaces, it may make sense to refactor these types into a special CORE MODULE
参考来源
- 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第124章《Abstract Core》(源文件:_epub-src/0321125215_ch15lev1sec8.html;单元01)
- 结论依据:原文说明纵向模块划分在高交互情况下造成引用或间接性,并以领域根本概念为抽象核心的前提;图15inf03显示结构变化。
- 原始内容:Consider slicing horizontally rather than vertically. Polymorphism gives us the power to ignore a lot of the detailed variation among instances of an abstract type. If most of the interactions across MODULES can be expressed at the level of polymorphic interfaces, it may make sense to refactor these types into a special CORE MODULE