Johannes Rabauer did a nice webinar just recently, using BDD to guide agents. Now what would happen if we did the same experiment with Event Modeling and Event Sourcing? Before you read the article - check out the running bdd-garage here - fully event-sourced using EVE.
Event Sourcing always felt right to me. Intuitively.
Just store what happened. Keep the facts. Use that information however you need it, today and in the future. Any business person would agree immediately.
But when I talk to teams, I hear a very different story. Most of them tried it at some point in time. They got burned badly. And they never touched it again.
When I look closer, I almost always find the same thing. What they did wasnāt Event Sourcing. It used events, yes⦠maybe an event table somewhere, but the system underneath was the same coupled design as before, just with many more moving parts.
So in this article, I donāt want to argue about Event Sourcing. I want to show you something.
A Nice Little Implementation
Recently, Johannes Rabauer did a nice experiment in one of his YouTube videos. He used BDD to guide agents in building software.
The example was a parking garage. Cars enter. Cars leave. You pay a fee. With a design I absolutely loved from the first minute.
The code he ended up with looked like this:
A FeeCalculator. A FeeController. A CheckoutRequest. Exactly what you would expect.
I want to be very clear about this: there is absolutely nothing wrong with this implementation. Itās simple. Itās straightforward. Itās a nice little piece of software.
And most projects start exactly like this.
Everything Is Somehow āFeeā Related
A problem might come up much later⦠Letās think about where this might go next.
The FeeController has a checkout function. That makes sense, checkout is when you pay.
Next, youāll add checkin. Thatās where the parking time starts, so itās fee related. It goes into the fee package.
Then someone loses their ticket. Report lost ticket. Thereās a special fee for that. Fee related, sure.
Itās all somehow fee related. So letās put this into the same place.
And then the next step feels completely natural. Since more and more āFeeā-related things come together, and someone read the Domain-Driven Design book - letās define the domain model for āFeesā. One central place that knows everything about money in our garage.
Most engineers reading this would nod in agreement. āMakes sense to meā¦ā I would have, too, for a big part of my career.
Then Management Asks for Online Payments
At some point, management walks in.
āWe need to support online payments.ā
Something we had never anticipated. And it simply doesnāt fit into the Fee model. I mean⦠not at all. Maybe itās a missing abstraction⦠maybe itās a wrong abstraction⦠itās always something.
The first reaction in the team is always the same: if only they had told us earlier.
So we do what responsible engineers do. We look at what it would take to do it properly, and we put a price tag on the refactoring. And itās a big one. Even with AI.
Of course, thatās rejected. Nobody will pay for that. From the outside, online payments look like a small feature.
āLetās do the quick fix. Youāll get time later to fix this.ā
Yeah, sure⦠like last time?
How the Workaround Becomes the System
So now we have this workaround.
But before we can fix it, we need to implement more features for the next release. And those features are built on top of the workaround, because thatās whatās there.
People go on vacation. People leave the company. New people join and learn the system as it is today, workaround included. More workarounds are added in the meantime, each one perfectly reasonable on its own.
And at some point, the workaround has become part of the ācoreā system. Thatās how we do Fees⦠just nobody remembers why anymore.
Nobody decided this. Nobody did anything seriously wrong. It just happened, one release at a time.
The Real Problem
The real problem isnāt obvious at first sight. Itās coupling.
Over time, everything became somehow correlated. Checkin, checkout, lost tickets and now online payments all hang on the same Fee model. Changing one thing always means changing other things as well.
And if you change one thing, you have to test half of the system, because you simply cannot tell how big the impact really is.
Sometimes the feature looks small, but the blast radius is enormous.
Itās why the refactoring price tag looks absurd to management. From their side, online payments is one feature. Just add it. Management doesnāt know about coupling.
From our side, itās a change that touches everything that has ever been āsomehow fee relatedā.
Both sides are right. And thatās the problem.
The Same Garage, as 8 Slices
Now, what happens if we use EVE instead? (E)vent Modeling, (V)ertical Slices and (E)vent Sourcing?
I pointed EM-Studio to Johannesā codebase and invoked the āAnalyze Codebaseā skill. The idea is simple: read the existing system and turn it into an Event Model. āFind the process.ā
The process itself was pretty straightforward. The final model had 8 slices.
Just that there is no concept of āFeeā in the Event Model. We look at the use cases like āIssuing a new Ticketā, āPaying the Parking Feeā or āReporting a lost ticketā. No place for a central Fee model.
Each slice is one thing that happens in the garage. One request⦠one query⦠And the only thing they share is events. Online payments? Probably just a handful of new slices.
The Rules Came Along for Free
There was one part of this that made me especially happy.
Johannes had already provided the business rules as Gherkin. That was the whole point of his experiment, using BDD to guide the agents.
Those rules translated directly into Given / When / Thens on the Event Modeling board.
And from the Event Model, they translated again, directly, into executable specifications in code.
Gherkin to Event Model to executable specs. The business rules survived the whole conversion without getting lost in translation.
This matters more than it might seem. The biggest fear with any modernization, migration or rewrite is that the new system quietly behaves differently than the old one. With the rules living as specifications all the way through, you have a safety net. The new system has to pass the same rules the old one was built on.
The biggest fear is not a system that breaks immediately. Itās the one that breaks 3 months after the release. Now we have some funā¦
And thatās the real power of BDD and GWTs in Event Modeling - it does not specify how the system is or shall be implemented - it specifies how the system shall behave. And that remains true no matter the implementation.
Online Payments, Second Try
Now letās bring management back into the room.
Same request. āWe need to support online payments.ā
This time, itās just a handful of new slices. Completely orthogonal to what is already there. And we might add them later in another blog post.
IssueTicket stays as it is. ReportLostTicket stays as it is. TotalRevenue keeps working. Nothing existing has to be touched.
The blast radius shrinks to the size of the feature.
And suddenly, the conversation with management is very different. A small feature is actually small. The price tag roughly matches what they expected. Nobody has to say āyouāll get time laterā, because thereās nothing to fix later.
So, Is Converting Worth It?
Hereās the process I followed. Itās not rocket science. Just follow the steps in the video.
- Convert the existing system into an Event Model. Let the tooling read the code and show you what the system actually does. Let the agent guide you.
- Refine the model with business experts and AI. The first version is a starting point. The people who know the business close the gaps, and AI keeps asking the questions.
- Choose the blueprint architecture. Decide how slices will be built, so every slice follows the same structure.
- Build the slices. One at a time, each with its own executable specifications.
- Add new features. As new slices, next to the existing ones, not inside them.
Thatās it. No big bang rewrite. No months of refactoring that nobody wants to pay for.
What I Want You to Take Away
Converting to Event Sourcing isnāt the goal. Nobody cares.
The goal is to build something that stays maintainable for years and years.
Using EVE is a great way to get there, as everything is ājust another sliceā.
Instead of one big model, youāll deal with many small, tailor-made models per slice. At least for me, this is so much easier to reason about. And token usage fully confirms this on the agent side as well.
Making sure that a small feature stays a small feature, and that the next unexpected request from management doesnāt turn into a workaround that becomes the system.
Event Sourcing - and especially EVE - is a nice way to get there. Every slice stands on its own, connected only by the facts of what happened.
Want to see me doing this step by step? Just watch the video.
That was a fun little experiment - thanks Johannes Rabauer for the inspiration.
Want to learn this for real? Join the Agentic Engineer Cohort in January.
Links
- Original Video by Johannes Rabauer
- EM-Studio - Agentic Event Modeling Platform
- Build Kits on EM-Studio
- The running example
- Source Code
- The implementation is using Emmet by Oskar Dudycz
- EM Cheatsheet
- Event Modeling Use-Cases
- Explore Real World Event Models
Hands-On Event Modeling Workshop
Book a Call Today
Want to talk through how Event Modeling could work for your team or project? Letās have a quick, no-pressure conversation.
