Tuesday, October 30, 2007

Entities and Value Objects

Today, we had a book club meeting at work for Domain-Driven Design by Eric Evans. While discussing the differences between Entities and Value Objects, we came to these conclusions:


  • Entities naturally represent business entities (e.g. Customer, Order, Payment.) Value Objects are used as descriptors of business entities (e.g. Name, Color, Age.)
  • Entities have a strong continuing thread of identity that needs to be well established sometimes by having an extra ID field or a universal ID when transferred across multiple systems. Value Objects are easily identifiable based on their values, and can be easily passed around and used across systems due to that.
  • Entities are normally mutable, and thus incur synchronization overhead when multiple copies are modified across different systems. Value Objects are immutable, which makes them easy to cache and improve performance.


Let us know in the comments area if you know of other differences or if you ever made a conscious effort to make the distinction between Entities and Value Objects.

No comments: