DDD Concepts and Patterns – Value Object and Factory
This post is about the value object pattern and the factory pattern which are tactical patterns in domain driven design (DDD). Value objects define the second kind of domain objects besides entities. Their main characteristic is immutability: Attributes of a value object never change.
Factories are responsible for creating new objects and validate them. They help us identify and separate this functionality from the other parts of a domain object.