术语“价值对象”的词源/含义是什么?
我是一名具有.NET / PHP背景的程序员。
我最近回顾了关于 Flashbuilder 4 / ActionScript 的视频培训。视频培训中的一个视频名为“使用值对象创建数据模型”。我提到“值对象”对我来说是一个陌生的术语,并且真的不知道他是否指的是“模型”,这有点令人困惑,因为我只能将其理解为“模型”,但标题表明我们正在创建一个带有值对象的模型,表明它们是两个不同的实体。
培训师说,他被告知这是 Java 中一个相当常见的术语,有时也称为“传输对象”。事实上,“值对象”的维基百科页面重定向到“数据传输对象”,以及 stackoverflow 问题,例如 这个提到“值对象”也可能是“Java 中的映射对象”。
该术语的词源是什么?它与其他数据模型相关术语有何关系?它是否来自 Java 世界并在某个时候不再广泛使用?
I am a programmer with a .NET / PHP background.
I recently reviewed a video training on Flashbuilder 4 / ActionScript. One of the videos in the video training is named "Creating a Data Model with a Value Object". I mentioned that "value object" was an unfamiliar term to me and didn't really know if he meant by it "model" or not and it was a bit confusing since I can only understand it as a "model" yet the title suggests that we are creating a model with a value object, suggesting they are two different entities.
The trainer said that he was told this was a fairly common term in Java, also sometimes referred to as a "transfer object". In fact, the Wikipedia page for "value object" redirects to "Data transfer object", and stackoverflow questions like this one mention that a "value object" might also be a "mapped object in Java".
What is the etymology of this term and how does it relate to other data-model-related terms? Does it come from the Java world and did it at some point go out of wide-spread use?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这个术语似乎在不同的上下文中被过度使用。 Misko Hevery 将该术语描述为:我的解释是:
我同意的另一个描述是 http://c2.com/cgi/wiki?ValueObject< /a>
The term seems to be overloaded in different contexts. Misko Hevery describes the term as I interpret it:
Another description that I would agree with is the one at http://c2.com/cgi/wiki?ValueObject
我在 Jazoon 2010 上,Kevlin Henney 发表了关于“对象的价值”的演讲 - 我强烈推荐 观看或阅读演示文稿(涵盖价值对象)。对于我来说,内容太多,无法轻松总结,但我的解释是:
值对象
表示模型中信息的对象。它没有身份并且是不可变的。例如,日期 2010 年 10 月 13 日可以表示为值对象。它没有身份,2010 年 10 月 13 日始终是 2010 年 10 月 13 日 - 它永远不会改变。
如果有机会的话,我还建议您亲自聆听凯夫林的演讲。我发现他是一位非常好的演讲者。
您可能还想查看 Eric Evan 的《领域驱动设计》一书,因为我相信这是 Java 世界中值对象概念的现代来源。
I was at Jazoon 2010 where Kevlin Henney gave a talk on 'the Value of Objects' - I highly recommend watching or reading the presentation (which covers value objects). There's too much content for me to easily summerise, but my interpretation would be:
Value Object
An object representing information in a model. It does not have identity and is immutable. For example, the date 13 October 2010 can be represented as a value object. It does not have an identity and the 13 October 2010 is always the 13 October 2010 - it never changes.
I also recommend taking the opportunity to listen to Kevlin in person if you get the chance. I find him to be damn good speaker.
You may also want to check out Eric Evan's Domain Driven Design book as I believe this is the modern-day source of the concept of value objects in the Java world.