4 ms·
Other good examples of value objects are: - EmailAddress - PhoneNumber - FullName - Address Perhaps it's just my domain, but I find myself very often defin
by sly010 10y ago
Other good examples of value objects are:
- EmailAddress
- PhoneNumber
- FullName
- Address
Perhaps it's just my domain, but I find myself very often defining equality to various degrees for these concepts.
In fact I create value classes for any value that can have multiple valid encodings (e.g. keys and hashes in crypto, dollar value, etc). It makes it very easy to have all encoding/decoding code in one obvious place (in or near the object code). Encoding and decoding can then happen at the edges, and the core of the logic becomes much more readable ... but this gets into the Domain Object territory.