More Efficient Domain Modeling with EventStorming

When it’s time to start writing code to implement your Domain Model that you’ve so carefully collaborated with the Domain Experts on, you might find yourself asking questions about communication.

  • “How do I communicate between Bounded Contexts?”
  • “How do I let Aggregate A know about changes to Aggregate B?”
  • “What information belongs in this Event so Bounded Context A can know enough about Aggregate C in Bounded Context E to do X?“

Valid questions, no doubt. Ones you would expect to answer with a very clear, technical solution. However, ask other DDD experts and you’ll probably get answers around one theme…

  • “Sounds like you need to go back to the Domain Experts”
  • “Sounds like an issue with your Domain Model”
  • “What does the Ubiquitous Language say?”
  • “Tell me more about the Business Processes happening around this (not the Data)”

But you’ve already done that leg work. You held several meetings with the Domain Experts. You sat around a table, discussed the business at length, and may even have a Ubiquitous Language “Glossary” for reference. “You’re saying this wasn’t enough?” “You’re saying I’m still not ready to write code?”…

Getting from Here to There Quickly

There’s also a real danger in becoming the “Proxy Domain Expert” inside your team. You may be able to answer questions about how everyone in the business uses the software, how processes flow through them, etc… but you don’t know nearly as much as you think you know about the business.

Other DDD practitioners tell you this over and over again, and you do your due diligence. You call a meeting with Finance… then a meeting with Engineering… then a meeting with Marketing.

You learn a lot, and your team draws a nice Context Map based on your findings, and the visions of CQRS sugarplums dance in your head…

It shouldn’t stop there.

“Ugh, but I want to write something that’s Event Sourced, CQRS, Highly-Scalable, Polyglot Data now!

“If I only knew how to send this entire Aggregate Root to this other Bounded Context over the wire!”

How can we get from here to there quickly; ready to go with a walking skeleton without feeling unproductive like some kind of manager…? no offense to managers btw :)

WTF is EventStorming?

As asked in this Reddit comment: What the f*** is EventStorming?

EventStorming is a really efficient way to model your domain around what it should be modeled around - the business and the knowledge that domain experts have about it. It “blends lean and the theory of constraints into software development and domain-driven design” - Alberto Brandolini (inventor of EventStorming)

It is in contrast to the whiteboard session where devs sit in a room and talk about dev stuff until they have a pretty picture of classes, services, dbs, etc. Instead, it focuses on bringing the right domain experts into the room, getting rid of the chairs and the things that make meetings suck, and allowing everyone to start to understand what’s going on with the business and what the software team should be working on.

Instead of modeling business processes like a flow chart (how many times does the business follow a flow chart exactly how it’s drawn…?), we focus on domain events. Domain events happen to be a good way to model a DDD/CQRS architecture, since domain events are a good way to communicate between bounded contexts.

Reddit

Alberto Brandolini’s EventStorming has been proven to be a very successful way to not only quickly discover knowledge that is hidden in Domain Expert “silos” across a business, but also gain crucial insight about what we should be working on with a DDD approach.

In my answer to the Reddit poster’s question, I brought up Brandolini’s reference to Lean methodology because I feel that it is a great way to describe why EventStorming is so efficient. Lean is about eliminating work that is “Non-Value-Added” in a manufacturing setting.

It’s no secret that meetings are full of Non-Value-Added work. They, themselves are mostly Non-Value-Added work. Working on Bounded Contexts that don’t contribute to the business’s Competitive Advantage is also Non-Value-Added work.

While our work can Non-Value-Added if we don’t focus on the right problem - the business processes within the Core Domain are also full of Non-Value-Added work.

It’s the multiple handoffs to complete a task. It’s the back and forth and double checking that waste time. The bottlenecks inside the Core Domain are impacting the business’s Competitive Advantage. We should be focused on discovering those bottlenecks while we decide how we’re going to write the code to help remove constraints.

So EventStorming is about breaking down Domain Knowledge “silos” while identifying constraints on business processes that cause bottlenecks. We should be focused on relieving constraints that impact the business’s Core Domain.

What does EventStorming look like?

I’m going to use a startup for a quick example, even though EventStorming can be applied to various types of projects including legacy. EventStorming likely needs to be done in multiple iterations, each time honing in on a Domain Model that we can start prototyping ASAP. In this example, we’re doing the first iteration: the “Big Picture” session.

Imagine we are a startup who’s goal is to deliver video-based training material on modern software architecture using .NET. The training material will be aimed at new DDD/CQRS/ES practitioners who’d like to solidify their understanding of these concepts.

The startup is working on a Minimum Viable Product (MVP) that will deliver their video training to customers, as well as let them author and manage new courses and videos.

We begin with a visible legend, a modeling surface, no chairs, and a lot of different color sticky notes and markers…

To get things started, we start putting up yellow stickies representing events that happen in our domain:

We also add commands that initiate these events:

A purple stickie represents a “hot spot,” something we don’t know or don’t have enough information to understand. So we add them as we go…

Ok so lots of purple stickies. What does this tell us?

As a startup, we don’t really know as much as we thought we did. In our case, we need to sit down and come to a conclusion about a lot of things.

Back to the drawing board

The plethora of purple stickies indicates to us that we need to go back to the drawing board.

Click here to jump to the Appendix where the team has a detailed discussion about all of the hotspots they encountered in their first session.

After this lengthy discussion among the team, we go back for another EventStorming session. With new insight into the domain, we are able to start to organize the Domain Events more clearly:

We continue adding our commands:

An important part of EventStorming is allowing for an unlimited modeling space, so as we MUST add more space as we go:

After some real beneficial discussion and about a day’s worth of highly efficient learning, we have a pretty good canvas to begin identifying our Bounded Contexts, Value Objects, Entities, Aggregates, Events, etc. This secondary EventStorming session is known as “Design-Level” and we’ll talk more about that later.

Summary

A number of questions arise over how to communicate between concepts that are supposed to be separate in our Domain Model. While Domain Events is a technical solution that we can look at, we may also find a bad modeling decision has been made.

Having already put a lot of effort into meeting with the Domain Experts as prescribed by DDD, stopping with code and setting up more meetings doesn’t sound fun. EventStorming is a way to make sure our up-front efforts (and our refinement efforts) have maximum value.

This means that we are focused on learning the right things from Domain Experts, as well as identifying the right problems to solve with our software.

Take a look at the resources below for more information about EventStorming.

And don’t forget to sign up for my newsletter so you can get exclusive access to DDD/CQRS/ES resources delivered right to your inbox!



EventStorming Resources:


Related Posts:


Appendix

  • “What is the first page that a Person sees?”
    • Pluralsight: landing page with Browse button
    • Egghead.io: landing page with categories + video list for a category
      • also a search field in the bottom of the landing page
    • Codeacademy: pretty simple landing page with a sign-up page allowing free access?
    • Treehouse: landing page with no previewing or searching, just signup and pitches
    • Lynda: landing page top half with categories to chose from
      • bottom half “most popular courses in x category”
  • “Is there just one Product with multiple Product “Types”?”
    • Probably just a Product in the Billing/Sales/Checkout Subdomain, but Video/Course can be separate ideas when it comes to the Discovery/Search Subdomain
    • Depends on if we want to sell Subscriptions first and just release a couple free Videos from each Course for marketing/sneak-peek
      • overhead is pretty low for this - one Payment (monthly or yearly w/discount) and everything is available.
    • We also want to allow for small, one-off videos that explain a concept - probably free (this is an important concept that lends to our competitive advantage - it’s Marketing) alternative is to sell Video/Course/Subscription individually at different prices
      • overhead would be high for this is it YAGNI?
  • “What are the possible Product hierarchies (if there are hierarchies)?”
    • Single Q/A Video
    • Course -> Videos
    • Tag/Category (CQRS, DDD, ES) -> Courses -> Videos
      • this would be more “loose”, just a type of Course/Video
    • Curriculum -> Courses -> Videos (assumes a lot of videos already produced)
      • this would be stronger. follow this curriculum to “master” this topic
      • we probably want to wait on this
  • “Are all types of Products available in the search results?”
    • If we go with Course/Videos with Subscription only model, the search results should show Videos related to a search term in a way that the user can see the Course that the Video is under
    • We probably want to show the category the Video is under (i.e. DDD, CQRS, ES…)
      • Categories would be Tags and the user could choose to see all Courses/Videos under this Tag
  • “Should we use tagging for searching or just search on the text in the title/description?”
    • We should have tags for each category and they can be chosen to filter on instead of description text searching
  • “Should every Video be part of a Course?”
    • No, some Videos might just be for marketing to answer a concise problem/solution related to a topic
  • “Are individual Videos from a Course “purchasable”?”
    • No, we will be doing a Subscription based model for now because that is the quickest to implement
    • Free videos will exist outside of Courses, some Free some part of Subscription
  • “Should a User have a Profile in order to watch any Free Videos?”
    • Yes the user should have a basic Profile for Email Opt-In for future Promotions
  • “Will we have multiple Authors?”
    • Yes this would be ideal, however the overhead is that the Authors would need to be paid and that’s more complex https://www.quora.com/How-does-the-author-in-Egghead-io-get-paid
    • For now, we’ll have one Author… me and then we’ll decide how to go about adding Authors
      • as an Author, I’ll need a way to log in and upload new Content so this is a necessary feature regardless of how many (this is technical - but keep an eye on something like Markdown that will parse to all the necessary description info and stuff)
  • “How do we invite Authors to submit Videos?”
    • See above, for right now it will need to be tied to my User Role
  • “Do we need Content Authoring right away?”
    • See above, yea we need it just because we want a high frequency of new content being released with the Subscription model
  • “How would we pay Authors?”
    • Don’t know yet, only one Author for now
  • “Does Adding a Video also mean Releasing it to the Public?”
    • Yes for now, since only one Author (it’s a want, not a need)
    • There probably should be a way to share it to Social Media
  • “Can/Should there be an “Open Beta” for a Course/Video?”
    • That’d be nice, but not necessarily for our first iteration
  • “How do we set the Price of a Video/Course?”
    • We decided to do a Subscription based model so all Videos will be available for a Subscription
    • Thinking maybe $199/year (save $40) or $19/month
  • “Does Course/Video/Subscription need to be separated from a shopping cart standpoint?”
    • No we’re doing Subscription - just one Product
  • “Is Course/Video/Subscription just a type of “Product” from a Shopping Cart standpoint?”
    • See above re Subscription
  • “Should we just start with a Subscription-based model?”
  • “Should we do a Subscription model that allows access to all videos for a limited time?”
    • Yes, we will want to take away access if a Subscription
      • Canceled
      • Expires
      • Renewal with Credit Card doesn’t work
    • We will also want to offer an Auto Renew option
  • “Should we do a trial Subscription for a limited time?”
    • Yes we want to offer a 1 month trial
      • It’ll require a Profile and Credit Card info so when it should become a Subscription the Payment will start
        • Will need to keep track of when someone starts a Subscription
        • Will need to keep track of when a Persons free trial ends
        • Will need to notify the person when their Subscription will Start so they can Cancel if they don’t actually want it
  • “How do we handle Credit Card charging issues?”
    • Declined
    • Expired
      • This might be something that we use a 3rd party API to handle Separate bounded context?
  • “Would a Subscription-based model make this easier?”
    • Yes
  • “Will we want to change the model eventually?” Probably not the complexity might not mean more competitive advantage
Tweet
comments powered by Disqus