Value Object

Go to the Wiki Overview

  • In terms Domain-Driven Design, a Value Object is pure data. Two Value Objects with the same attributes are equal, and even identical. (Evans 2006, pp97–193)
    • This is a contrast to Entities which express identity not through their attributes, but by being a thing that persists over time.
    • In the sense of a programming language feature, Value Objects can be implemented as value types. If you know value types, you get the idea of Value Objects. (Only that Value Objects can actually be implemented as reference types with custom equality checks, like we used to do in Objective-C all the time where everything was an object.)

Classic example: Money or Date. The instances don’t matter, only the value.

Posts on the topic