知识卡片

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

实体身份跨表示延续

理解等级:中级

实体的核心是贯穿生命周期的“同一个”,即使名称、地址等属性变化,或在不同数据库和程序中变成不同对象实例,仍需能追踪其业务身份。反过来,两个对象属性完全相同也可能是不同实体:同日同额存入同一账户的两笔交易仍是两笔。语言中的引用相等只说明是否指向同一内存对象,不能替代领域身份判断。参见[[实体与值对象按身份区分]]。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第36章《原书第05章|Entities (a.k.a. Reference Objects)》(源文件:_epub-src/0321125215_ch05lev1sec2.html;05inf01.gif 为身份意象图) - 结论依据:原文用同名房客、跨系统客户及同日同额的两笔银行交易说明属性不等于身份,并明确将内存引用身份与领域实体身份区分。 - 原始内容:Some objects are not defined primarily by their attributes. They represent a thread of identity that runs through time and often across distinct representations. ... Two deposits of the same amount to the same account on the same day are still distinct transactions, so they have identity and are ENTITIES .