知识卡片
模块命名空间不代表模型边界
Module 组织代码中的元素并提供命名空间;Bounded Context 声明一套模型的适用范围及维持统一的责任。不同模型通常放在不同模块,但模块分开本身并不表示模型已分开:同一上下文也会有多个模块。
若把每个模块当成独立模型,就可能忽略本该统一的概念;反过来,命名空间的隔离还可能遮住同一模型内部悄然分裂的迹象。判定边界须看实际团队协作与模型语义,而非目录结构。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 原书第14章|B OUNDED C ONTEXTS Are Not M ODULES · 查看原书依据
But MODULES also organize the elements within one model; they don't necessarily communicate an intention to separate CONTEXTS. The separate name spaces that MODULES create within a BOUNDED CONTEXT actually make it harder to spot accidental model fragmentation.
参考来源
- 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第101章《BOUNDED CONTEXTS Are Not MODULES》(源文件:_epub-src/0321125215_ch14lev1sec1_split_001.html;单元01)
- 结论依据:原文明确区分模块与限界上下文的动机,说明同一模型内也有模块,命名空间甚至可能遮蔽模型碎裂。
- 原始内容:But MODULES also organize the elements within one model; they don't necessarily communicate an intention to separate CONTEXTS . The separate name spaces that MODULES create within a BOUNDED CONTEXT actually make it harder to spot accidental model fragmentation.