知识卡片

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

值对象按描述而非身份理解

理解等级:初级

值对象表示领域中的某种描述性特征,关注“是什么”,无需追踪“是哪一个实例”。原书画笔例子中,孩子选择颜色、笔尖形状合适的画笔,丢失后换一支同样的笔仍可继续画;画作及画者可能要区分身份,画出每条线的具体画笔却无须追踪。是否有概念身份取决于当前业务用途,不能仅凭它在程序里是对象实例就判为实体。参见[[实体身份跨表示延续]]。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 原书第05章|Value Objects · 查看原书依据

      An object that represents a descriptive aspect of the domain with no conceptual identity is called a VALUE OBJECT. VALUE OBJECTS are instantiated to represent elements of the design that we care about only for what they are, not who or which they are.

    参考来源

    - 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第37章《原书第05章|Value Objects》(源文件:_epub-src/0321125215_ch05lev1sec3_split_000.html;05inf02.jpg 为画笔示意照片) - 结论依据:原文用可互换画笔与需区分的孩子、画作对照,并将无概念身份且表达描述性方面的对象定义为值对象。 - 原始内容:An object that represents a descriptive aspect of the domain with no conceptual identity is called a VALUE OBJECT . V ALUE OBJECTS are instantiated to represent elements of the design that we care about only for what they are, not who or which they are.