1.Topics‎ > ‎Architecture‎ > ‎Patterns‎ > ‎a.Design Patterns‎ > ‎C.Structural Patterns‎ > ‎

K.Value Object

  1. Motivation
    1. To create a small simple object, like money or a date range, whose equality isn't based on identity.
  2. Summary
    1. Value Object is usually the smaller; it's similar to the primitive types present in many languages that aren't purely object-oriented.
    2. The key difference between reference and value objects lies in how they deal with equality. A reference object uses identity as the basis for equality
  3. When to Use
    1. Treat something as a Value Object when you're basing equality on something other than an identity. It's worth considering this for any small object that's easy to create.
  4. Overview Tutorials
    1. http://martinfowler.com/eaaCatalog/valueObject.html
  5. Implementation
    1. .NET has a first-class treatment of Value Object. In C# an object is marked as a Value Object by declaring it as a struct instead as a class.
    2. The environment then treats it with value semantics.
  6. Example 
    1. Money or Date Range object
  7. Related Patterns
    1. Data Transfer Object : are some time treated as Value Object.
    2. Embedded Value 
    3. Serialized LOB
  8. Related Technologies 
    1. None
  9. References
    1. None