Value Object
- 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
Jan 18 2023 | |
Nov 29 2022 |
Mutating Struct and State Observers: How the Latter Will Be Notified Even for 'No-Ops' |
Mar 8 2019 | |
Jun 16 2018 | |
Jun 6 2018 | |
Jun 9 2016 | |
Feb 1 2016 |
Always Write Functions to Cope with all Possible Parameter Values |
Oct 16 2015 |