Design Level Event Storming

4-hour workshop

Schedule

  1. Overview of Event Storming - 10 minutes
  2. Design level - 50 minutes
  3. Lending domain - 30 minutes
  4. 60-minute workshop
  5. 60-minute workshop
  6. Wrap-up and Q&A - 20 minutes
Design level EventStorming workshop

‼ Walls of text warning ‼

I wanted you to be able to refer back to this. It's not a normal presentation. Please don't take notes, this is publicly available. Think of it as a blog post in presentation format.

Design level EventStorming workshop

Overview of event storming

Design level EventStorming workshop

Big-picture event storming - 1

  • It is an exploration of a company, across it's domains and subdomains
  • Focusing on the events that drive the business
  • NOT only software
  • Psychological safety is key to success
  • Doesn't work well in virtual space :(
Design level EventStorming workshop

Big-picture event storming - 2

  • Highly collaborative
  • Everyone understands what the business does
  • Everyone understands what other people do...
  • ...and how
  • Amazing way to discover issues...
  • ...and discuss opportunities
  • Most importantly: discussions happen
  • Also, a big heuristic for domain and sub-domain boundaries
Design level EventStorming workshop

Process-level event storming - 1

  • Demonstrated how things get done
  • Again through a focus on the events...
  • ...plus commands and policies (and data)
Design level EventStorming workshop

Process-level event storming - 2

  • A great way to view workflows and processes
  • An amazing way to discover important policies
  • Very collaborative
  • Easier to demonstrate problems where they happen
  • Great way for a product-delivery team (or stream-aligned team) to agree on what to build

** product-delivery team: combination of product, domain experts, developers, testers, etc working together on a customer facing work

Design level EventStorming workshop

Why event storming and not something else?

  • It's not an either\or choice...
  • It can work very quickly
  • Can provide immense value
Design level EventStorming workshop

Why not event storming?

  • Needs active participation
  • Needs buy-in
  • Needs psychological safety (to ask uncomfortable questions)
  • Doesn't work for all teams, but it's dependent on the people, not the context
Design level EventStorming workshop

Design-level event storming

Design level EventStorming workshop

Why do we use it?

  • Focuses on the dynamic view (workflows)
  • Team agrees and confirms:
    • Allocation of responsibilities
    • Transactional boundaries \ aggregates
    • Domain services
    • Important entities
    • Behaviour to implement
  • Discover missed functionality and discuss it
Design level EventStorming workshop

What Design level does not do:

  1. Doesn't document algorithmic decisions
  2. Doesn't work well for structural analysis
    1. Although complex static structures \ hierarchy is best avoided in most case
Design level EventStorming workshop

Specifically about allocation of responsibilities

‼ Avoiding structural and semantic allocation of responsibilities helps avoid "god" classes and reduces rate of change and duration for rework ‼

Design level allows us to design by focusing on dynamic view, avoiding this

Design level EventStorming workshop

Grammar

Design level EventStorming workshop

Design level has two phases:

➭ The "linear" phase
➭ The "boundary-setting" phase

Design level EventStorming workshop

Phase 1: The linear phase

  • we model the system in a linear manner
  • Very similar to process level
  • We focus on the sequence of decisions we need to make...
  • ...but add the info we need to decide consistency boundaries
Design level EventStorming workshop

The linear phase step-through - 1

  1. Take a process and copy its anchor points
  2. Add events, considering code-level decisions
  3. Add systems in this step and users
  4. Do a narrative walkthrough to confirm your model can support the process
Design level EventStorming workshop

The linear phase step-through - 2

  1. Add commands
  2. Add policies between events and commands
  3. Add the minimal amount of consistency you need between commands and events using an aggregate sticky. Add read models
  4. Use a policy sticky with the same name across different places for a process manager
  5. Repeat for all processes you own or all processes affected by the new requirement \ request for change
Design level EventStorming workshop

Tips

⭐ For what fits in an orange sticky, think about unit tests. We want to discover units of behaviour. An orange sticky should be the decision of one method of domain logic (and maybe some helpers)
⭐ Don't get stuck on validations, but don't ignore them either. If you discover you're discussing invariants, represent these with a transactional boundary
⭐ Make a point to discover policies between events and commands
⭐ Don't be too strict about grammar. Use it as a heuristic, not a law

Design level EventStorming workshop

Tips #2

⭐ Hide stuff you don't want to discuss (a library, another service that you don't want to touch) behind a system sticky. Do this when you're discussing a new feature and you don't want to make big changes
⭐ When you want to confirm your boundaries, do NOT hide behaviour you own behind a systems sticky. Do this from time to time.
⭐ Name your policies by the rule they apply ("Always do X when Y", "We don't accept Z combination because of ABC reasons" etc)

Design level EventStorming workshop

Tips #3

⭐ If you find you need something special because it's important to you, don't be afraid to add it (like a PM sticky). Do make a consious effort to avoid this however, and only add these if it helps unblock discussions
⭐ Long names are fine. Now it's good to be descriptive
⭐ Add hotpots for problems you're discovering, but try to resolve them before finishing the linear phase if possible
⭐ It's fine to branch. Use vertical space liberally

Design level EventStorming workshop

What good phase 1 looks like?

➭ It answers yes to the following questions:

♥ Does one event correspond to one XUnit unit test or feature?
♥ Is the data in aggregate stickies really the minimum amount of data required to guarantee the decision can be made? (ignoring data in command)
♥ Is the data in aggregate really the minimum amount of data where we need to enforce immediate consistency?
♥ Policies apply one "rule"

Design level EventStorming workshop

Phase 2: Boundary setting

  • We discover and agree on boundaries \ aggregates
  • Allows for collaborative exploration of boundaries
  • It's very important, and very valuable
    • The biggest failures in software I've seen (outside of architectural-level bad decisions) is about allocating responsibilities to units of behaviour
Design level EventStorming workshop

Boundary setting Step-through #1

  1. Draw arrows from and to policies
  2. If you're sure stale data are accepted remove the yellow sticky and replace it with a read model
  3. Command-System-Event stickies are your ACL layer showing through...
  4. Group Command-Aggregate-Event stickies together into "behaviour groups"
  5. Group Command-Event tuples without system into "domain services"
Design level EventStorming workshop

Boundary setting step-through #2

  1. Move behaviour groups with same aggregate very close
  2. Add workflows to source data you don't get from commands. You may need to go back to phase 1 for this
  3. Decide if you want to move policies into aggregates OR have them standalone
  4. Experiment moving your behaviour groups, domain services and policies until you're happy with the coupling and cognitive load your decision represents
Design level EventStorming workshop

Tips #1

⭐ Domain services can live in a boundary of their own or within an aggregate
⭐ Stateless policies are great!
⭐ Prefer using stale data when possible. This allows you to move your domain service anywhere, so as to reduce coupling. Very useful to remove coupling between the source of the data and the logic that needs that data as input. Experiment!

Design level EventStorming workshop

What good phase 2 looks like

♥ Small aggregates
♥ Good balance of aggregate size and dependencies between aggregates
♥ Small number of dependencies between boundaries

Design level EventStorming workshop

Intro to domain

Design level EventStorming workshop

Domain: Lending company

  1. Lending startup
  2. Focus on VERY low risk loans:
    1. Get info by partnering with employers
    2. Amazing underwriting capabilities
    3. Use salary sacrifice
Design level EventStorming workshop

Why this domain?

  • No biases from previous experience
  • Savvas have tons of experience on this
  • Lots of similarities to PVR situation:
    • Very server-side heavy
    • Lots of policies
    • Long-running processes
  • Many decisions with trade-offs
Design level EventStorming workshop

The context

  • People apply for a loan and provide their employment details
  • The company gets paid by employer directly OR by DD from borrower
  • Very thorough underwriting process unless the borrower has perfect credit history
  • To reduce the exposure from funders, the lending company calculates repayments so that interest is repayed first
  • The company needs to show a clear, consistent audit log of repayments, late payments and underwriting data and decisions
Design level EventStorming workshop

For this (too small) workshop, we'll focus only on one small part of the domain 👇

Acquisition and repayments

Design level EventStorming workshop

Go to miro for walkthrough

Design level EventStorming workshop

Hands-on time

Design level EventStorming workshop

Hands on

  1. Split into groups of 3-5 people
  2. We'll do two 1-hour sessions
    1. Try to finish phase 1 before the middle of the second session, ideally during the first 1-hour session
  3. Follow the rules above for design level
  4. Contact me if you have any questions, either on slack or Zoom
Design level EventStorming workshop

Wrap up - Q&A

Design level EventStorming workshop