15 Dec 2023



Intermediate
FeatureValue ObjectEntity
IdentityNo distinct identity. Equality based on attributesHas a distinct identity
MutabilityTypically immutableCan be mutable
LifespanUsually short-lived, tied to an aggregate rootCan have a longer lifespan, exists on its own
Equality ComparisonBased on attribute valuesBased on identity (ID or key)
Relationship to DatabaseOften stored directly within the owning entityMay have a separate database table
ExampleMoney, AddressUser, Order, Product

Note: These characteristics provide a general overview, and the specifics might vary based on the design choices and the context in which they are used. In some cases, an object may exhibit characteristics of both entities and value objects depending on its usage in a particular domain model.

domain-driven-design-ddd
differences
value-objects
entities