Pragmatic Objects
  • Pragmatic Objects
  • What's an Object ?
  • Thinking Object
  • Practices
    • The Pragmatic Practices
    • No Getters & Setters
    • Inherit Wisely
    • Wrap Null
    • Wrap Primitives
    • Wrap Collections
    • Expose Snapshots
    • Abandon Composed Names
    • Don't Check Types
    • Minimize Knowledge
    • Immutability
    • Separate Commands & Queries
    • Abandon Statics
    • Invert Dependencies
  • Patterns
    • Domain Model
    • Always Valid
    • Wrapper
    • Command
    • Procedural Object
    • Compute Object
    • Snapshot
    • Value Object
    • Observability
  • Examples
    • Celsiuses / Fahrenheits
Powered by GitBook
On this page
  1. Patterns

Value Object

Object wrapping a value.

PreviousSnapshotNextObservability

Last updated 1 year ago

A value object is an object wrapping a value to treat it like an object instead of a primitive. It's often used in combination with the Always Valid to validate the wrapped value.

Value objects are . Two value objects carrying the same value are equivalent, they have no concept of identity.

They often contain computations such as sums, differences, comparisons and so on.

Immutable