Value Objects
Explore the concept of value objects in Domain Driven Design and understand how they represent immutable domain elements identified by their attributes. This lesson demonstrates how value objects support business logic without unique IDs, using practical examples such as Amount and transfer validations to model complex requirements effectively.
We'll cover the following...
As was shown in the previous lesson, DDD uses tactical patterns to represent a model. Consider the situation in which we need to create an object that does not need identification, such as an amount with value and currency. Value objects are useful in such cases.
Before going further with the definition of value objects, it is worth looking at a common situation of the real world. This example, taken from Eric Evans book on DDD, describes what a value object is from the real-world perspective:
“When a child is drawing, he ...