知识卡片
实体身份取决于业务用途
同一现实事物是否作为实体,要看当前业务是否需要区分并持续追踪它。原书体育场例子中,对号入座时每个座位须按座位号识别;不对号入座时系统只需总座位数,刻在座位上的号码不构成售票模型的身份要求。若仍把具体座位绑定到后一类门票,反而会表达不存在的业务限制。身份是模型为解决问题作出的选择。参见[[实体身份跨表示延续]]。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 原书第05章|Entities (a.k.a. Reference Objects) · 查看原书依据
The model must define what it means to be the same thing. Identity is not intrinsic to a thing in the world; it is a meaning superimposed because it is useful.
参考来源
- 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第36章《原书第05章|Entities (a.k.a. Reference Objects)》(源文件:_epub-src/0321125215_ch05lev1sec2.html)
- 结论依据:原文以指定座位和自由入座作对照,指出同一物理座位在两种售票业务模型中分别需要与不需要实体身份。
- 原始内容:The model must define what it means to be the same thing. Identity is not intrinsic to a thing in the world; it is a meaning superimposed because it is useful. ... Although the seat numbers are still engraved on the physical seats, there is no need for the software to track them.