← 返回刚才阅读的位置

知识卡片

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

值对象也可承载行为

理解等级:中级

值对象不等于只有字段、没有逻辑的简单数据块。原书设想调色软件中的颜色对象参与计算并产生新颜色;房屋设计中的窗户样式、尺寸和约束也可组成较复杂的值对象。它们虽有行为与内部结构,业务仍只关心描述结果而不追踪某个实例的身份。与[[领域服务承载独立动作]]相比,这些行为仍围绕值对象所表达的概念。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第38章《原书第05章|Is "Address" a V ALUE O BJECT ? Who's Asking?》(源文件:_epub-src/0321125215_ch05lev1sec3_split_001.html) - 结论依据:原文明确指出值对象不必简单,并以调色和房屋窗户设计两种假设性软件展示其复杂算法与组合结构。 - 原始内容:These basic examples are simple, but VALUE OBJECTS are not necessarily simple. For example, a color-mixing program might have a rich model in which enhanced color objects could be combined to produce other colors. These colors could have complex algorithms for collaborating to derive the new resulting VALUE OBJECT .