value-objects
Installation
SKILL.md
Value Objects
When to use
- The user wraps a primitive (money, email, coordinate) in an immutable type with invariants.
- The user needs two domain values to be considered equal when their contents match, not their identity.
- The user passes bare strings or ints for domain concepts and wants a dedicated type to stop mix-ups.
When NOT to use
- Do not model something with a distinct identity and mutable lifecycle (a User, an Order) as a value object.
- Do not build a value object when the value is simply one of a small closed set of named options.