Comparison
Tiny typevsValue object
Tiny type
the two ids were both strings, you passed them in the wrong order, and nothing complained until production.
A one-field value object wrapping a primitive so the type system can tell a customer id from an order id. It is the cheapest available cure for primitive obsession and for the class of bug where two same-typed arguments get swapped. The objection is boilerplate, which is real in some languages and nearly zero in those with value classes or type aliases with checking.
Full entry →Value object
two of them with the same contents are interchangeable, so you never update one — you replace it.
An object defined entirely by its attributes, compared by value and, by convention, immutable: money, a date range, a coordinate, an email address. Immutability plus value equality means it can be shared freely, used as a map key and reasoned about without aliasing. Most of the practical benefit of domain modelling comes from making more things value objects, because each one takes a validation rule out of the calling code and puts it somewhere it cannot be skipped.
Full entry →