Representing the business.
WHAT A DOMAIN MODEL IS
Code representing the concepts and rules of the business.
WHY IT MATTERS
Rules scattered through handlers and queries cannot be found, tested or trusted.
WHAT TO IDENTIFY
The concepts the business talks about The rules governing them The operations that change them
WHAT TO USE
The language the business uses.
WHY
Translation between terms produces misunderstanding and bugs.
WHAT AN ENTITY IS
Something with identity persisting through changes.
WHAT A VALUE IS
Something defined entirely by its attributes, without identity.
WHY THAT DISTINCTION HELPS
It clarifies what may be replaced and what must be tracked.
WHAT TO ENFORCE IN THE MODEL
Invariants: conditions that must always hold.
WHY
So an object cannot exist in an invalid state.
WHAT TO AVOID
Models that are only data, with rules elsewhere Very large models accumulating everything Rules duplicated in several places
WHAT TO TEST
The rules, without any database.
WHAT TO DOCUMENT
The terms and their meanings.