event based modeling - eng
Post on 18-Sep-2014
5 views
DESCRIPTION
English version of the accompanying slide deck. But from now on I'll call it Event-Storming ;-)TRANSCRIPT
![Page 1: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/1.jpg)
1giovedì 23 maggio 13
![Page 2: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/2.jpg)
Goals
Quickly sketch a model for a complex system
Have the basic concepts of Domain-Driven Design emerge without prerequirements.
2giovedì 23 maggio 13
![Page 3: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/3.jpg)
3giovedì 23 maggio 13
![Page 4: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/4.jpg)
In practice...
Stick a paper roll on a wall.
We might have up to 25 metres of modeling space
Collaborative work
4giovedì 23 maggio 13
![Page 5: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/5.jpg)
Yes, I mean that much space...
5giovedì 23 maggio 13
![Page 6: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/6.jpg)
Domain EventsMight resemble an Activity Diagram
...but we’re not doing UML
Events cannot be discussed. They happened. Deal with it.
System-wide view.
Every team start to imagine a domain, instead of asking to the domain expert... :-(
Real system might be a lot simpler
Real system might be a lot more complex6giovedì 23 maggio 13
![Page 7: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/7.jpg)
Hint:
...it gets a lot more interesting if we explore areas we don’t know.
... with the domain expert.
... with concrete examples.
7giovedì 23 maggio 13
![Page 8: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/8.jpg)
8giovedì 23 maggio 13
![Page 9: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/9.jpg)
Event Origin
Events do not just appear out of the blue:
some originate from user actions
some originate in external systems
some are generated by time
...some are originated as a response to other events
9giovedì 23 maggio 13
![Page 10: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/10.jpg)
10giovedì 23 maggio 13
![Page 11: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/11.jpg)
FLOW (team decided this way)
Team decided to start from the right... we called it WOLF instead of FLOW then.
11giovedì 23 maggio 13
![Page 12: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/12.jpg)
12giovedì 23 maggio 13
![Page 13: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/13.jpg)
Event Flow
Search for predecessors or consequences of our events
Using verbs in the past helps clarify the semantics:
“wedding” is not an event, it’s a process (don’t tell it to your wife)
More actors are joining our system
13giovedì 23 maggio 13
![Page 14: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/14.jpg)
14giovedì 23 maggio 13
![Page 15: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/15.jpg)
Aggregates
“How do I correctly define aggregates?” ... yes, that’s THE question
Have a look to DDD mailing lists, if you don’t believe it
Our goal is to define aggregates outside in
15giovedì 23 maggio 13
![Page 16: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/16.jpg)
DefinitionAn aggregate represents consistency unit: a group of classes changing state together.
...but it’s not always clear enough...
...how big these objects are?
...how do they look like?
It has something to do with transactional boundaries but ours might be wrong.
16giovedì 23 maggio 13
![Page 17: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/17.jpg)
Rule of thumb
To sketch aggregate boundaries we can think about
Informations deleted together
Informations moved together
Informations distributed together
...but that’s still a little too data-centric
17giovedì 23 maggio 13
![Page 18: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/18.jpg)
Invariants
Forget data:An aggregate can accept or reject a command.
Upon which information?
What is always guaranteed for our aggregate?
18giovedì 23 maggio 13
![Page 19: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/19.jpg)
19giovedì 23 maggio 13
![Page 20: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/20.jpg)
Aggregates
Shifting the focus on invariants helps aggregate modeling
Smaller, more controllable units
Variations are propagated via Domain Events
A better domain exploration
The whole is eventually consistent
20giovedì 23 maggio 13
![Page 21: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/21.jpg)
Example
Max particpants per class:
Where does this constraint come from?
Classroom capacity? --> accept and look for a better location (if there’s time available)
Class physiological limit --> stand-by and waiting list or propose next edition
No accidental complexity requirements.
21giovedì 23 maggio 13
![Page 22: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/22.jpg)
22giovedì 23 maggio 13
![Page 23: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/23.jpg)
SubdomainsBusiness level system partitioning
Some portions are core for our company competitivity.
Es. things that are going to sell more.
Other are simply necessary, but no key differentiators.
Es. invoicing: it’s needed but no customer will choose us for the invoice layout. Good enough is good enough.
23giovedì 23 maggio 13
![Page 24: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/24.jpg)
LanguagesIn mid/large-sized companies we’ll have many stakeholders.
Different goals
different backgrounds,
different languages
...will require different models
Caution: we aren’t talking about Bounded Contexts...yet
24giovedì 23 maggio 13
![Page 25: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/25.jpg)
25giovedì 23 maggio 13
![Page 26: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/26.jpg)
Bounded Contexts
Highlight the different models in playSoftware components
Legacy components
Languages used
They’re a realistic snapshot, not the image of our wishes...
26giovedì 23 maggio 13
![Page 27: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/27.jpg)
27giovedì 23 maggio 13
![Page 28: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/28.jpg)
Users & Personas
Got a chance to include users and their categories in the picture? Why not!?
We can highlight personas and make them part of the model...
...especially if this triggers an interesting conversation with the domain experts.
28giovedì 23 maggio 13
![Page 29: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/29.jpg)
29giovedì 23 maggio 13
![Page 30: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/30.jpg)
TestsSome interesting details might emerge during the conversation. Why not take a note?
In natural language
...according to BDD lingo (--> Cucumber)
In an event driven perspective, the structure Given [events] When [command] Then [event] fits very well :-)
30giovedì 23 maggio 13
![Page 31: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/31.jpg)
31giovedì 23 maggio 13
![Page 32: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/32.jpg)
Takeaways
Model of a complex enterprise system ignoring data
... what if data model is part of the problem?
Tight focus on system behavior and not on static data structure.
32giovedì 23 maggio 13
![Page 33: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/33.jpg)
Takeaways
The model is created collectively in a cooperative learning fashion and provides a good high-level view.
Are you sure DEs know everything?
Time-boxed, but....
Space-boxed but....
33giovedì 23 maggio 13
![Page 34: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/34.jpg)
Legacy Systems
The sketched model is close to an “ideal system model”
It’s NOT the starting point to rewrite from scratch!
But it’s a good reference to establish a direction
Legacy components that do not belong in the domain emerge like accidental complexity.
batch operations, legacy stuff feel really inappropriate.
34giovedì 23 maggio 13
![Page 35: Event based modeling - eng](https://reader034.vdocuments.us/reader034/viewer/2022051608/5419dc247bef0a65128b54c5/html5/thumbnails/35.jpg)
35giovedì 23 maggio 13