Patterns and slices
Four patterns organize the story. A slice is the piece that a team builds.
After this page, you can:
- name the four patterns and the question each one answers
- say what a slice is and why slices talk only through Events
- read a small canvas with its lanes and columns
Four shapes that repeat
Every model uses four patterns. A pattern is a small chain of building blocks. Each pattern answers one question.
| Pattern | The question | The chain | Example in the clinic |
|---|---|---|---|
| State Change | What does someone want to change? | Screen or Automation, Command, Event | Staff add an appointment. |
| State View | What does someone need to know? | Event, Read Model, Screen or Automation | Staff look at the calendar. |
| Automation | What must the system do next by itself? | Event, todo list, Automation, Command, Event | The system adds a weather forecast to each new appointment. |
| Translation | How does a fact from another system become a fact in our words? | External Event, todo list, Automation, Command, internal Event | The clinic turns a changed forecast of the weather provider into its own Event. |
Try first: which pattern turns an intent into a fact? Which pattern turns facts into an answer?
Show the answer
State Change turns an intent into a fact. State View turns facts into an answer.
Automation: the todo list
An Automation keeps a todo list. The list is a Read Model. It is a queue of work that is still open. These rules describe it:
- An opening Event adds a row. A completion Event removes the row.
- A row exists while the work is open. Do not add a status field that says "done".
- Every Automation has a todo list, even a simple relay.
- Plan the failures. A business failure records a failure Event. A technical error leaves the row in the list, so the Automation can try again.
Example: the Event Appointment Added adds a row to Appointments without weather forecast. The Automation Add Weather Forecast sends the Command Add Weather Forecast. The Event Weather Predicted for Appointment removes the row.
Translation: facts from outside
Another team or system uses its own words. You must not copy its facts into your model as they are. A Translation turns an outside fact into a fact of your own, in your own words.
- The outside Event opens a row in a todo list.
- A translation Automation reads the row, sends a Command, and records an internal Event.
- A translation list has no closing Event. It relays facts. It does not track finished work.
- Add a worker after the translation only if it makes a new decision.
Page 6 explains correlation, repeated delivery, and other risks of outside facts.
Slices: the pieces you build
A slice is the thinnest cut through the model that a team can build alone. A slice holds one of these:
- one Command, with the Screen that starts it and the Events it records
- one Read Model, with the Screen that shows it
- one Automation, with its todo list, its Command, and its Events
If Place Order needs both a Command and an order detail view, you have two slices. Name each slice after its main element.
Slices do not share state. They talk only through Events. Slice B depends on slice A when B uses an Event that A produces. Write the dependency as "depends on Events from A", not "depends on slice A".
Try first: the slice Calendar reads the Event Appointment Added. Which slice does it depend on?
Show the answer
It depends on the slice Add Appointment, because that slice produces Appointment Added.
Slices follow each other in a few allowed orders:
- State View, then State Change
- State Change, then State View
- State Change, then Automation
- Automation, then State Change
- Automation, then State View
A State Change must not follow a State Change directly. A Screen or an Automation must sit between them to trigger the second one.
Reading a canvas
A canvas draws a model on a grid. Time runs from left to right, so each column is one moment. Each row is a lane. The table shows a small canvas for the clinic.
| Lane | Column 1 | Column 2 | Column 3 | Column 4 |
|---|---|---|---|---|
| Clinic Staff (Screens) | Schedule Appointment | Calendar | ||
| Automations | Add Weather Forecast | |||
| Commands and Read Models | Add Appointment | Calendar | Appointments without weather forecast | Add Weather Forecast |
| Events | Appointment Added | Weather Predicted for Appointment |
Follow the story from column 1. Staff use the Screen, and the Command records the Event. The Event feeds the calendar in column 2. It also opens a row in the todo list in column 3. The Automation in column 4 sends a Command. The Event in column 4 closes the row in column 3.
Six rules keep a canvas clear:
- A column is one moment. It holds at most one Event.
- Every human role has its own lane. All Automations share one lane.
- An arrow goes down inside a column, or forward to a later column. It does not go backward.
- The one exception is an Event that closes a row in a todo list. It points back to the list, as column 4 does.
- A todo list sits one column before its Automation.
- Place elements in story order, not by type. Do not put all Events first and all Commands after them.
A chapter is one story, such as one user journey. A canvas can hold many chapters, one below the other. Keep a chapter to about six to fifteen columns. Split it at a natural phase boundary if it grows longer.
Check yourself
A slice holds the Command Place Order and the view Order Detail. What do you do?
Answer
Split it into two slices. A slice holds one Command, one Read Model, or one Automation.
A model shows Add Appointment and then Confirm Appointment. Nothing sits between them. What is missing?
Answer
A trigger. A Screen where a person confirms, or an Automation that confirms, must issue the second Command.
Where does the todo list of an Automation go on the canvas?
Answer
In the same lane as other Read Models, one column before the Automation.
A translation list has a closing Event. Is this right?
Answer
No. A translation relays facts and has no closing Event. Only an ordinary worker list removes rows with a completion Event.
Remember:
- Four patterns repeat: State Change, State View, Automation, and Translation.
- Every Automation has a todo list. A row stays while the work is open.
- A slice is one Command, one Read Model, or one Automation. Slices talk through Events.
- A canvas reads from left to right. Arrows do not go back, except to close a todo list.