Event Sourcing & CQRS · Event Sourcing Concepts
Modeling Domain Events
Discover events with Event Storming and name them well.
Good events capture business facts in past tense using domain language: OrderPlaced, PaymentAuthorized, ShipmentDispatched — not technical diffs (OrderUpdated, StatusChanged). Discover them collaboratively with Event Storming or Event Modeling workshops (domain experts + engineers on a timeline of events, commands, policies and read models). Events should carry the data needed to understand the fact without reading other state.
Event naming
| Weak event | Better event | Why |
|---|---|---|
| OrderUpdated {status: 'cancelled'} | OrderCancelled {reason, cancelledBy} | Captures intent and context |
| CustomerChanged {fields...} | CustomerRelocated {newAddress} | Business meaning |
| ItemQuantitySet {qty: 3} | ItemAddedToCart {sku, qty} | Fact, not state snapshot |
| PriceFieldModified | PriceAdjustedForPromotion {promoId} | Explains why |
Event Storming (timeline, sticky-note colors)
[Command] PlaceOrder → [Aggregate] Order → [Event] OrderPlaced
[Policy] "When OrderPlaced, authorize payment" → [Command] AuthorizePayment → [Event] PaymentAuthorized
[Read model] Customer order history ← built from OrderPlaced, OrderShipped, OrderCancelled
[Hot spot] "What if payment authorization times out?"
Common pitfalls
- CRUD-style events that lose intent.
- Events named after UI actions or technical operations.
- Modeling without domain experts.
Key points
- Past tense, domain language
- Capture intent and context
- Event Storming to discover
Further reading: EventStorming
Practice questions
Why is 'OrderUpdated' a weak event name?
Answer
It doesn't say what happened or why; consumers must diff state to infer meaning, and business intent (cancelled, re-addressed, discounted) is lost.
What is Event Storming?
Answer
A collaborative workshop technique where domain experts and engineers map a business process as a timeline of domain events, commands, aggregates, policies and read models.
Open in the app to mark lessons complete, take notes and track your progress.