I was sent a video on the concept of event storming recently. Thisβll be a more concrete note on the concepts behind Event Storming/Domain-Driven Design, and my thoughts on phasing it in.
Colors/Terminologies
Workflow Atoms
- π§ Domain Event:
- Past-tense Language. Understand the business, bridging definitions from problems to associated solutions.
- Events being reacted to, hence past tense
- π« Actor:
- Actual user being defined in the background. Sets role contexts, authorizations, capabilities by actual user.
- π¦ Command:
- Action made by actor to trigger the domain event. Many-to-one relationship with π§ Domain Events.
- πͺ Policy:
- Constraints on class constructors β conditionals between π¦ Command and π§ Domain Events to determine if the state is in a position for the command to trigger domain event(s), or which domain events can be triggered.
- π₯ Hotspot:
- Attached to policies(?)
- System/API-specific πͺ Policies related to non-internal-state issues, such as errors or unavailability.
State Atoms
- π© Model/View: Actual data entries/tables representing the underlying state of the application
- SCHEMAS, not concrete TABLES. This is because model/view is also used to define responses from π External Systems.
- π External System:
- External (non-app-owned) APIs. Backing data for a) π© Model/View, providing the backing data from external APIs in a standard schema consumed by the application (NOT DIRECTLY BY WORKFLOWS) and b) vital for π₯ Hotspots related to external API availability.
Molecules
- π¨ Aggregate Entry:
- Keywords and terminology of aggregates. E.g. in e-commerce, βcartβ is related to all of the individual workflows AND data for a given feature
Initial Thoughts
The term βAPI surfaceβ has been flashing around in my brain a lot lately, and this seems to be a nice way to describe layers of the application:
- API Surface:
- π« Actor defines users based on their roles
- π§ Domain Event defines what the API should be able to βreactβ to
- π¦ Command represents what commands are available to trigger those π§ Domain Event reactions
- πͺ Policy entries define what actions from π« Actor can be reacted to via π§ Domain Event based on the authorization, as well as state, of the application
- π₯ Hotspot seems to be a subset of this for error states
- Internals/Under-the-hoods:
- π© Model/View defines the actual data backing the application using strong schemas (three cheers for strong schemas!)
- π External System defines data/state retrieved through π© Model/View that is not owned by the application (such as an external API) that the application has less control over, and must be accounted for with π₯ Hotspot entries
- Conceptual:
- π¨ Aggregate is used to βcollectβ all of the above into higher-level concepts
Phasing
Using Event Storming for product planning breaks into distinct phases:
- Chaotic Exploration: Define the surface purely by π§ Domain Event entries and π₯ Hotspot entries
- This feels slightly confusing, since π₯ Hotspot entries seem to have a hard dependency on π External System. Maybe itβs just general error states?
- It seems like the use case for this β particularly phase 1 βΒ would be for rapid note-taking during business meetings to try and define the shape of the user interaction surface. Basically, making sure that you and the folks on the business side have the same βshapeβ of the application before beginning even technical planning, never mind technical development.
- The immediate Phase 1 hop from βWhat can this doβ into βHow can this fuck upβ feels a bit cart-ahead-of-the-horse. That may be an initial knee-jerk reaction, so Iβm going to roll with this for now until Iβve done it a few times before making a judgement.
- Timeline Enforcement: Ordering the Chaotic Exploration by the natural lifecycle of when events happen. Creating connections between π§ Domain Event entries that are placed in a logical order of βπ§ X must occur before π§ Yβ.
- Iβm not sure if π₯ Hotspot continues to play a βprimaryβ role in this, and more that the timeline enforcement bubbles up potential timing issues (e.g. βπ§ X must happen before π§ Y, so a YβX would cause hotspot π₯ Z to occur)
- Commands/Actors: Flesh out with π¦ Commands and π« Actors, namely how endpoints need to be declared, how they interact, and what will be necessary to complete a full feature.
- Entities: Group the workflows, logically, into domains via π¨ Aggregates
- Policies/Read Models: Work out advanced logic for πͺ Policies, including authorization by π« Actor role. Establish what schemas are necessary to satisfy the π¦ Command requirements for each π¨ Aggregate.
Phasing session thoughts
The Phase 1 being π§ Domain Event and π₯ Hotspot feels somewhat confusing. With the goal of speaking in real-world, shared terms with business folks, I feel that itβd make sense to go with π« Actor and π§ Domain Event entries first, then going into Timeline connections for Phase 2, then going with π₯ Hotspot for Phase 3.
The idea would be:
- Business Meeting: This is the portion where the business side and engineering side meet together to form the outer shape of the application. The goal is not to bikeshed implementation details (or for engineering to have strong opinions). The goal is to agree on the user-facing shell of the application, its capabilities, and its behaviors.
- Phase 1: Chaotic Entries (π§, π«)
- Goal: Organize a barrage of high-level information from the business side. What is the goal of the app/feature? What should the user be able to do?
- This provides a note-taking structure to user stories. Using π« Actors and π§ Domain Events, you should be able to organize user categorize and what the users expect to be able to accomplish via π§ Domain Events
- Phase 2: Timeline Organization (π§, π«, π₯)
- Goal: Sort the π§ Domain Events into chronological stories, developing the full user stories.
- As engineers, itβs good to understand that chains of π§ Domain Events that occur earlier will have simpler seed data (e.g. an empty cart) and that Events that occur later will require more complicated data with more failure points. This is where π₯ Hotspots can be introduced. It is likely that π§ Domain Events further out will have more π₯ Hotspots. The chronological ordering can help identify where, given a π§ Domain Eventβs dependencies, where failure points could occur.
- Phase 1: Chaotic Entries (π§, π«)
- Follow-up Engineering Meeting: Once the shape of the application is agreed on, engineering breaks out into a follow-up to come up with concrete implementation details. Largely the same as above.
- Phase 3: Commands: Figure out the actual API surface, constructed with π¦ Commands with πͺ Policies introduced to set up the advanced conditionals between π« Actors executing π¦ Commands and the π§ Domain Events they trigger. (π§, π«, π₯, π¦, πͺ)
- Phase 4: Entities: Logical grouping of workflows into π¨ Aggregates (π§, π«, π₯, π¦, πͺ, π¨)
- Phase 5: Tying up the necessary schema for the state of the application via π© Model/View, and what is necessary via π External Systems (and how these introduce new π₯ Hotspots) (π§, π«, π₯, π¦, πͺ, π¨, π©, π)