Member-only story
DDD — Entity and Value Types
Published in
4 min readFeb 27, 2022
What are Entity and Value Types in Domain Driven Design?
In Domain-Driven Design: Tackling Complexity in the Heart of Software by Eric Evans, Entity and Value Types are 2 of the fundamental building blocks that the concepts in the rest of the book are built on. Let’s take a look at what they are and why they matter.
Entities
In DDD, an Entity is something that has an identifier and an owner. It can be mutable, but has a thread of continuity throughout its lifetime. Let’s break that down using a car as an example:
- An Entity has an identifier: A good example of an Entity is a car, which is identified by its license plate.
- An Entity has an owner: If a car gets a parking ticket, or is involved in an accident, the authorities can find out who owns the car by looking at records that map a car to its owner. The owner can sell the car and transfer ownership to somebody else. The owner can also acquire a new car.
- An Entity can be mutable: An owner can change things on a car. They can change the wheels, the tires, the colour of the car, the engine and other parts. They can extend the car with body kits.
- An Entity has a thread of continuity: To return to the parking ticket example, if the car has changed…