← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 1971.o.1.b.1.a.2.a.1.b.5.f

通用子域只做所需且保持概念纯净

理解等级:高级

自己实现通用子域时,不必为了未来代码复用做全功能设计;只做当前业务所需的自洽部分,把主要精力留给核心域。模型概念本身以后或许可复用,但这不是现在扩张实现的理由。

同时要防止把行业专属规则塞进通用模块:这会使后续扩展通用能力更难,也把本应属于核心域或独立专门子域的知识藏错位置。最小实现与概念边界要同时成立。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 原书第15章|Generic Subdomains · 查看原书依据

      The second, and more important, reason is that those industry-specific concepts belong either in the CORE DOMAIN or in their own, more specialized, subdomains, and those specialized models are even more valuable than the generic ones.

    参考来源

    - 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第119章《Generic Subdomains》(源文件:_epub-src/0321125215_ch15lev1sec3.html;单元05) - 结论依据:原文反对以代码复用为目标过度建设通用子域,却要求通用模型保持概念纯净,避免混入行业专属知识。 - 原始内容:Note that while I have emphasized the generic quality of these subdomains, I have not mentioned the reusability of code. [...] This would go against the basic motivation of distillation: that you should be applying as much of your effort to the CORE DOMAIN as possible and investing in supporting GENERIC SUB-DOMAINS only as necessary. Reuse does happen, but not always code reuse. The model reuse is often a better level of reuse, as when you use a published design or model. [...] You can model and implement only the part you need for your business. Though you should seldom design for reusability, you must be strict about keeping within the generic concept. Introducing industry-specific model elements will have two costs. First, it will impede future development. [...] The second, and more important, reason is that those industry-specific concepts belong either in the CORE DOMAIN or in their own, more specialized, subdomains, and those specialized models are even more valuable than the generic ones. - 转录说明:三处 `[...]` 分别标明不追求代码复用的推论、模型复用的限定说明,以及通用模型日后扩张困难的细节;原 EPUB 的 `GENERIC SUB-DOMAINS` 保留原拼写。