Skip to content

Commit bfd2da0

Browse files
committed
Adding a proper event model
1 parent aaa255b commit bfd2da0

File tree

2 files changed

+9
-20
lines changed

2 files changed

+9
-20
lines changed

Novanet/2026/03/event-model.png

283 KB
Loading

Novanet/2026/03/event-modeling.md

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -53,28 +53,17 @@ That's it. Command comes in, event gets recorded, read model gets updated. Every
5353

5454
## A concrete example
5555

56-
Let's take a simple hotel booking system. Over time, the events on the timeline might look like this:
56+
Here's a real event model — a visitor and room operations system:
5757

58-
```mermaid
59-
timeline
60-
title Hotel Booking - System Events Over Time
61-
section Guest
62-
RoomSearched : Guest browses availability
63-
RoomSelected : Guest picks a room and dates
64-
BookingCreated : Guest confirms the booking
65-
section Payment
66-
PaymentInitiated : Guest submits card details
67-
PaymentApproved : Payment processor confirms
68-
section Hotel Operations
69-
RoomAssigned : Room assigned to booking
70-
CheckInCompleted : Guest arrives and checks in
71-
CheckOutCompleted : Guest leaves
72-
RoomCleaningScheduled : Housekeeping notified
73-
```
58+
![Event model showing room assignment, visitor check-in, check-out and cleaning schedule slices](event-model.png)
59+
60+
Reading it left to right, the system tells a story through five workflow slices:
61+
62+
Each vertical slice is independent. `AssignRoom` fires and `RoomAssigned` is recorded. `CheckIn` fires and `CheckinCompleted` is recorded. The `Visitor` read model is then *projected* from those events — it doesn't care how the data got there, it just reads the event stream and builds a view the front end can display.
7463

75-
Notice how the model tells a story. From the first interaction all the way through to the end. Anyone can follow it. You don't need a computer science degree to understand what's happening here.
64+
Notice what this means in practice. A developer picking up the "Check In" slice knows exactly what they're building: handle the `CheckIn` command, validate it, record a `CheckinCompleted` event. Done. They don't need to understand the whole system. A product owner looking at the same model can ask: "What information do we need to show on the Visitor list?" — and point straight at the `Visitor` read model to have that conversation. An operations manager can trace what triggers a cleaning schedule without reading a single line of code.
7665

77-
And here's the thing — when a developer sees `BookingCreated`, they know exactly what to build. When a product owner sees `RoomCleaningScheduled`, they can immediately ask: "Should we notify the housekeeper by SMS or only in the app?" The model surfaces those conversations *before* they cost you three sprints to fix.
66+
That's the point. Everyone is looking at the same thing, and everyone understands it.
7867

7968
---
8069

@@ -137,7 +126,7 @@ Event Modeling and Event Sourcing are not the same thing — but they're natural
137126

138127
Event Modeling is a *design* technique. It works for any system, including traditional CRUD-style architectures. You don't need event sourcing to use it.
139128

140-
That said, if your system is built on event sourcing — where the events themselves are the source of truth — then the model and the implementation speak the same language from day one. The `RoomBooked` event in your model *is* the event your code produces and stores. No translation layer. No impedance mismatch.
129+
That said, if your system is built on event sourcing — where the events themselves are the source of truth — then the model and the implementation speak the same language from day one. The `CheckinCompleted` event in your model *is* the event your code produces and stores. No translation layer. No impedance mismatch.
141130

142131
If you want to understand event sourcing more, I'd recommend [Martin Dilger's book](https://leanpub.com/eventmodeling-and-eventsourcing) — he covers both techniques and how they reinforce each other. I wrote separately about [event sourcing and why it matters](https://novanet.no/stop-losing-information-event-sourcing/) — the short version: stop throwing information away.
143132

0 commit comments

Comments
 (0)