知识卡片
实体与值对象按身份区分
给领域概念选择对象形态时,先问它是否需要跨状态变化仍被追踪为“同一个”:需要连续身份的是实体;只是描述另一对象当前状态的属性,则倾向值对象。这一区分帮助明确对象含义,并引导后续设计选择。这里是初步判别,不凭字段是否相同就断定两个实体相同;具体关联与生命周期规则还需结合后文。参见[[领域层承载模型实现]]。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Chapter Five. A Model Expressed in Software · 查看原书依据
Does an object represent something with continuity and identitysomething that is tracked through different states or even across different implementations? Or is it an attribute that describes the state of something else? This is the basic distinction between an ENTITY and a VALUE OBJECT.
参考来源
- 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第34章《Chapter Five. A Model Expressed in Software》(源文件:_epub-src/0321125215_ch05.html)
- 结论依据:原文以跨状态和实现的连续身份,对照描述其他对象状态的属性,直接给出实体和值对象的基本区分。
- 原始内容:Does an object represent something with continuity and identitysomething that is tracked through different states or even across different implementations? Or is it an attribute that describes the state of something else? This is the basic distinction between an ENTITY and a VALUE OBJECT .