Glossary

Value Object

A Value Object represents a concept through its value, not through an identifier. Two Value Objects are equal when their fields are equal. Always immutable: instead of mutation, a new object is returned.

Examples

Money, Email, PhoneNumber, DateRange, Coordinates — concepts with no identity of their own. Money(100, 'USD') equals another Money(100, 'USD').

Benefits

Vs Entity

An Entity has an identifier and can change (a User with id=42 remains the same User even if the name changes). A Value Object has no id — identity equals value.