jargon

Comparison

Embedded valuevsValue object

Embedded value

the money object became two columns on the same row rather than a table of its own with a foreign key.

Mapping a value object into the columns of its owner's table rather than giving it a table and an identity. It is how an address, a money amount or a date range stays a proper object in the model without becoming a row with a lifecycle. It is the single most useful mapping technique for anyone trying to escape primitive obsession without doubling their table count.

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 →

Related comparisons