知识卡片

普通读书笔记卡 · 1971.o.1.b.4.d.1.c.3.c.1

技术分区只保留必要规则

理解等级:高级

技术分区应满足真实部署或开发需要,同时留出按领域概念组织模块的空间。分开领域层与界面、基础设施代码是有用边界;持久化代码过于复杂时也可抽离。若没有实际跨服务器部署需要,应尽量把同一概念对象的实现放在同一模块。声明式设计生成、无需人工阅读的代码则可单独隔离,以免干扰开发者理解模型。参见[[技术分包勿拆散领域对象]]。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第41章《原书第05章|Modules (a.k.a. Packages)》(源文件:_epub-src/0321125215_ch05lev1sec5.html) - 结论依据:原文认可领域层隔离和必要的持久化分离,要求最少技术分区规则、无实际分布需求时保持概念对象同模块,并对生成代码给出例外。 - 原始内容:Choose a minimum of technical partitioning rules that are essential to the technical environment or actually aid development. For example, decoupling complicated data persistence code from the behavioral aspects of the objects may make refactoring easier. Unless there is a real intention to distribute code on different servers, keep all the code that implements a single conceptual object in the same MODULE , if not the same object. [...] Use packaging to separate the domain layer from other code. Otherwise, leave as much freedom as possible to the domain developers to package the domain objects in ways that support their model and design choices. One exception arises when code is generated based on a declarative design (discussed in Chapter 10 ). In that case, the developers do not need to read the code, and it is better to put it into a separate package so that it is out of the way, not cluttering up the design elements developers actually have to work with. (`[...]` 标明非连续省略;`MODULE ,` 的空格沿用原 EPUB 标签抽取形式。)