mhinze.com

Matt Hinze, learning in public

More On Value Objects

A few days ago Dylan Beattie wrote a nice post about value objects.  He explains the idea in a more palatable way than my attempt: If it’s not clear how to model a particular element in your model, try asking “which one?” If the question makes sense within your own scenario then you’re probably dealing [...]

Adding to a Value Object property always adds to it, never adds another instance to it.  Distinguishing Value Objects by maintaining a collection of them implies identity. It is a mistake to attempt to maintain a collection of Value Objects. Let’s take the near-canonical Address, a perfectly valid Value Object as described on page 98 [...]