知识卡片
政策层用规则引擎仍须与对象共享模型
Policy 层保存目标和约束,可作为参数传给下层方法,也可通过策略模式配合 Decision Support。它有时由规则引擎实现,但技术实现不同不必然意味着另一个限界上下文。
若规则语言基于一套模型、被约束的领域对象又基于另一套模型,两者协调会变得复杂,甚至迫使对象失去表达力。原书因此强调跨实现形式仍应认真保持模型一致;规则引擎不是绕开领域建模的捷径。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 原书第16章|Responsibility Layers · 查看原书依据
Policy layers can be written in the same language as the other layers, but they are sometimes implemented using rules engines. This doesn't necessarily place them in a separate BOUNDED CONTEXT. In fact, the difficulty of coordinating such different implementation technologies can be eased by fastidiously using the same model across both. When rules are written based on a different model than the objects they apply to, either the complexity goes way up or the objects get dumbed down to keep things manageable.
参考来源
- 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第130章《Responsibility Layers》(源文件:_epub-src/0321125215_ch16lev1sec3.html;单元05)
- 结论依据:原文列出政策与其他层交互的方式,并说明规则引擎不自动产生独立上下文,异构模型会抬高复杂度。
- 原始内容:Policy layers can be written in the same language as the other layers, but they are sometimes implemented using rules engines. This doesn't necessarily place them in a separate BOUNDED CONTEXT. In fact, the difficulty of coordinating such different implementation technologies can be eased by fastidiously using the same model across both. When rules are written based on a different model than the objects they apply to, either the complexity goes way up or the objects get dumbed down to keep things manageable.
- 转录说明:原 EPUB 强调标签边界产生的术语前空格已规范转录。