O'Reilly logo

Implementing Domain-Driven Design by Vaughn Vernon

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Immutable

An object that is a Value is unchangeable after it has been created.1 When programming in Java or C#, for example, you use one of the Value class’s constructors to create an instance, passing in as parameters all objects on which its state will be based. The parameters may be the objects that will directly serve as the attributes of the Value, or they may be objects that will be used to derive one or more newly constituted attributes during construction. Here’s an example of a Value Object type that holds a reference to another Value Object:

1. There are times when a Value Object can be designed as mutable, but the need is usually rare. I don’t dwell on mutable Values here. If you are interested in when to use a mutable Value type, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required