Domain design
Before picking technology I design the domain: which words the business uses, what the entities are, which rules belong to whom. The contexts that show up in that drawing become the boundaries of the system; the code only repeats what the design already said.
Decisions and why
- Business language in the code
- If the business says "operation", "line" and "stage", the classes are Operation, ConveyorLine and Stage. A wrong name becomes a wrong rule.
- Bounded contexts before services
- Identity, contract flow, payments and files have their own rules and data. I split them in the design first; only then do I decide whether one becomes a service.
- Derivable state is not a column
- In conveyor an operation has no status: it is where it sits (line + stage). One more column would be a second truth drifting out of sync.
- Invariants live in the entity and in the database
- moveTo() keeps the rule in code and a constraint keeps it in the database. Two layers, because concurrency happens.
requestresponse
Pick a scenario above to watch the message travel through the architecture.