1 of 26

Event Modeling

Marian Schubert

2 of 26

Why?

3 of 26

Why?

Fixed Price ✅

Integration Tests

No Mocking

No Ceremonies

No Backlog

No Ticketing Systems

🏃‍♂️Work Parallelization

Shared Understanding

Information Completeness

Guaranteed

Code matches model

DDD

(no books required)

No Magic

(Words)

Specification By Example

Simple

4 of 26

How?

What?

5 of 26

Event Model example - Hotel

6 of 26

UI / API / Job

7 of 26

Events

Room Added, Room Booked, Checked In, …

8 of 26

Read Models (Views)

Cleaning Schedule, Sales Report, … per use-case

9 of 26

Commands

Add Room, Book Room,

Check In, …

10 of 26

Automation

Treat it like humans would do it. Also, metrics, SLAs, …

11 of 26

Automation

Treat it like humans would do it. Also, metrics, SLAs, …

12 of 26

Event Model example - Hotel

13 of 26

14 of 26

Why?!

15 of 26

Shared understanding

It’s pretty simple to explain

16 of 26

Work in slices

Possibly in parallel, open-closed principle,

rewrite whole slice, …

Slice #1

Slice #2

17 of 26

Implementation

matches model

You can find Add Room, Room Added, Room Availability in production code.

18 of 26

Information

completeness

19 of 26

Testing

Specification by example, Unit-tests, …

20 of 26

Resources - The End

  • https://eventmodeling.org/
  • Event Modeling from Beginner to Expert • Adam Dymitruk • YOW! 2023
    • https://youtu.be/Pin_B-AbdXE

21 of 26

22 of 26

Patterns

23 of 26

Patterns

Given -> When -> Then

24 of 26

Patterns

Given -> Then

25 of 26

26 of 26

AuthorizeTransaction(

trnId = trn.trnId,

response = runCatching { someClient.authorize(authorizationRequest) },

processingRoute = authorizationRequest.processingRoute,

isFailuresThresholdExceeded = isFailuresThresholdExceeded

).execute()