← 返回刚才阅读的位置

知识卡片

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

领域服务承载独立动作

理解等级:初级

有些领域概念更像“执行一项动作”,而不是一个需要身份或承载状态的对象。若操作难以自然归属某个实体或值对象,可把它表达为供调用方请求的领域服务,避免为了保持对象形式而硬塞职责。这里的“服务”指领域模型中的行为表达;技术层也有服务,不能只凭名称混为一谈。参见[[实体与值对象按身份区分]]。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • Chapter Five. A Model Expressed in Software · 查看原书依据

      Then there are those aspects of the domain that are more clearly expressed as actions or operations, rather than as objects. Although it is a slight departure from object-oriented modeling tradition, it is often best to express these as SERVICES, rather than forcing responsibility for an operation onto some ENTITY or VALUE OBJECT. A SERVICE is something that is done for a client on request. In the technical layers of the software, there are many SERVICES. They emerge in the domain also, when some activity is modeled that corresponds to something the software must do, but does not correspond with state.

    参考来源

    - 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第34章《Chapter Five. A Model Expressed in Software》(源文件:_epub-src/0321125215_ch05.html) - 结论依据:原文将更适合表达为动作的领域活动与实体、值对象对照,并说明可在领域中建模为应调用方请求执行的服务,技术层服务另有存在。 - 原始内容:Then there are those aspects of the domain that are more clearly expressed as actions or operations, rather than as objects. Although it is a slight departure from object-oriented modeling tradition, it is often best to express these as SERVICES , rather than forcing responsibility for an operation onto some ENTITY or VALUE OBJECT . A SERVICE is something that is done for a client on request. In the technical layers of the software, there are many SERVICES . They emerge in the domain also, when some activity is modeled that corresponds to something the software must do, but does not correspond with state. (术语前后的空格沿用原 EPUB 标签抽取形式。)