42
EventStorming Jeppe Cramon © Copyright 2015 TigerTeam ApS © Copyright Jeppe Cramon - TigerTeam ApS 2015 1

Event storming

Embed Size (px)

Citation preview

1. EventStorming Jeppe Cramon Copyright 2015 TigerTeam ApS Copyright Jeppe Cramon - TigerTeam ApS 2015 1 2. Why should you be interested? Copyright Jeppe Cramon - TigerTeam ApS 2015 2 3. No technology, framework or pattern can fix having bad or wrong requirements Copyright Jeppe Cramon - TigerTeam ApS 2015 3 4. How to gather requirements from many different departments/specialists? Copyright Jeppe Cramon - TigerTeam ApS 2015 4 Department C Department E Department A Department D Department B 5. Sequential data gathering? Copyright Jeppe Cramon - TigerTeam ApS 2015 5 Time 6. Or design by committee? Copyright Jeppe Cramon - TigerTeam ApS 2015 6 7. Software development is journey Involving collective learning Copyright Jeppe Cramon - TigerTeam ApS 2015 7 8. So lets find a fun and better way to do it Copyright Jeppe Cramon - TigerTeam ApS 2015 8 9. Event Storming Event Storming is a fun way of bringing developers and business experts together and drive your analysis from the outside and quickly explore complex business domains in hours instead of days/weeks. 10. Event Storming Event Storming (or Model storming) is a way of starting your analysis from the outside and quickly explore complex business domains. Invented by Alberto Brandolini See http://ziobrando.blogspot.dk/2013/11/introducing- event-storming.html Copyright Jeppe Cramon - TigerTeam ApS 2015 10 11. Much requirements gathering still follow in the steps of structural or classic OO design We write use cases/stories and afterwards look for nouns and verbs Copyright Jeppe Cramon - TigerTeam ApS 2015 11 12. Usually we start with a simple model Copyright Jeppe Cramon - TigerTeam ApS 2014 12 13. And as time goes by Copyright Jeppe Cramon - TigerTeam ApS 2014 13 14. It gets more and more complicated Copyright Jeppe Cramon - TigerTeam ApS 2014 14 15. And finally we drown Copyright Jeppe Cramon - TigerTeam ApS 2014 15 16. We end up with One Domain Model to Rule them All Copyright Jeppe Cramon - TigerTeam ApS 2014 16 17. Cant we avoid ceremonial modeling? Something easier, faster and better? 18. Event Storming Invite the right people people with questions and people with answers. They provide the perfect mix of curiosity and wisdom. Provide unlimited modeling space Copyright Jeppe Cramon - TigerTeam ApS 2015 18 19. Event Storming is Powerful come up with a comprehensive model of a complete business flow in hours instead of weeks. Engaging: bring people with the questions and people who know the answer in the same room and to build a model together Efficient the resulting model is perfectly aligned with Event Sourcing and EDA, and allows for a quick determination of Bounded Context and Aggregate boundaries and thereby also Service boundaries Easy the notation is ultra-simple. No complex UML Fun Eventstorming workshops and fun, people are energized and deliver more than they expected. The right questions arise, and the atmosphere is the right one. Copyright Jeppe Cramon - TigerTeam ApS 2015 19 20. How to run a Event Storming Workshop Explore the domain starting from Domain/Business Events Copyright Jeppe Cramon - TigerTeam ApS 2015 20 Event 21. Why Events Simple semantic and notation Represent the state transitions Gives us precision Easy to grasp by everybody in the room Place them along a timeline to visualize the process An event might be the predecessor or the follower of another one. Copyright Jeppe Cramon - TigerTeam ApS 2015 21 22. Events An Event message is non-prescriptive of what should happen in other services. It leaves this open to the recipients, so that they themselves determine what to do based on occurrence of the event. Events always carry a name in its past-tense form: OrderWasAccepted, OrderHasShipped, CustomerWasReimbursed Other qualities Immutable, i.e. content cannot be changed Always carries the ID of the Business Object it relates to An event can and will typically will be published to multiple consumers. The publisher of the event does not know who the recipients are And it doesnt know what the recipients intend to do with the event Copyright Jeppe Cramon - TigerTeam ApS 2015 22 An Event describes something that HAS happened 23. How to run a Event Storming Workshop What causes Domain Events? User Action model it as a Command External system Time Other Domain Events Documents Copyright Jeppe Cramon - TigerTeam ApS 2015 23 External Time Command Role Event Event Document 24. Events are often the side effect of Commands A Command message is prescriptive of what should happen. This is a stronger form of coupling than Event and Document messages. A Commands primary goal is to capture USER INTENT A Command supports a single usecase and targets a single Business Object Commands always carry a name in its imperative form: CreateOrder, ShipOrder, CancelOrder, ReimburseCustomer, etc. Other qualities Immutable, i.e. content cannot be changed Always carries the ID of the Business Object that it relates to A command can only be handled by ONE service The Operations that consume Commands dont return values but can throw exceptions Copyright Jeppe Cramon - TigerTeam ApS 2015 24 A command describes a Task that you want someone else to carry out for you and the recipient can reject the Command 25. Commands & Events Commands mutate Business Object state which results in one or more Events being published Copyright Jeppe Cramon - TigerTeam ApS 2015 25 Command Event(s) AcceptOrder OrderAccepted ShipOrder OrderShipped AddComment CommentAdded QuarantineReview ReviewQuarantined UnquarantineReview ReviewUnquarantined 26. Commands & Events Copyright Jeppe Cramon - TigerTeam ApS 2015 26 Receives a Command Asynchronously Publishes multiple Events asynchronously 27. Using Business Events to drive Business Processes Copyright Jeppe Cramon - TigerTeam ApS 2015 27 Sales Service Shipping Billing Sales Customers MessageChannel Online Ordering System Web Shop (Composite UI) Billing Service Shipping Service Order Accepted Event AcceptOrde r Command The sales fulfillment processing can now begin 28. Have you heard of flash mobs? Copyright Jeppe Cramon - TigerTeam ApS 2015 28 29. Choreographed Processes Copyright Jeppe Cramon - TigerTeam ApS 2015 29 Sales Service Order Accepted Billing Service Orderfulfilment Service Process Manager (Saga) Shipping Service Online Ordering System Message Channel Order Accepted Order Accepted Customer Billed Customer Billed Order Authorized Order Authorized 30. Documents can also drive processes Copyright Jeppe Cramon - TigerTeam ApS 2015 30 31. Before computers Copyright Jeppe Cramon - TigerTeam ApS 2015 31 Sales department Shipping department Billing Department 32. Document? Copyright Jeppe Cramon - TigerTeam ApS 2015 32 33. Example of a document driven business process Copyright Jeppe Cramon - TigerTeam ApS 2015 33 iueiuei iueiuei 1271871 iueiuei 1271871 Customer Department Account Department Payments Department 34. Most developers and business people are already familiar with this way of thinking Copyright Jeppe Cramon - TigerTeam ApS 2015 34 Todo In progress Done Work Board 35. How to run a Event Storming Workshop Explore Aggregates Outside In An Aggregate receives Commands and decides to execute them or reject them If the Aggregate executes a Command it will produce one or more Domain Events as a result Copyright Jeppe Cramon - TigerTeam ApS 2015 35 36. Aggregates Invoice InvoiceLine * Account * What: Cluster coherent Entities and Value Objects, with complex associations into Aggregates with well defined boundaries. Choose one entity to be root and control access to objects inside the boundary through the root. External objects hold references to the root Aggregates only refer to other aggregates by identity (their id) Motivation: Control invariants and consistency through the aggregate root. Enables: Loading schemes, coarse grained locking and Ensuring consistency & transactional boundaries for Distributed scenarios Root 37. How to run a Event Storming Workshop Explore Sub domains Different areas of responsibility map pretty well to different subdomains or portions of the pork Copyright Jeppe Cramon - TigerTeam ApS 2015 37 38. How to run a Event Storming Workshop Explore Bounded Contexts During the discussion, some conflict areas with regards to different interpretations of terms might emerge Draw boundaries between the multiple consistent models that will coexist in your domain. Copyright Jeppe Cramon - TigerTeam ApS 2015 38 Accep t Order Order Order Accepted Order Order Delivered Sales Delivery 39. Bounded Context Domain Driven Design (DDD) The setting in which a word or a statement appears that determines its meaning Ensures that our is clear and precise Copyright Jeppe Cramon - TigerTeam ApS 2014 39 40. How to run a Event Storming Workshop Other Targets: Sketching User Personas Sometimes the person issuing the command is important to capture Sketching Key Acceptance Tests If the discussion revolves around corner cases or ambiguous scenarios, remove ambiguity by defining a clear acceptance test Sketching Key Read Models For some scenarios what the users see is far more important than what the system does Copyright Jeppe Cramon - TigerTeam ApS 2015 40 41. Event Storming Legend: User Action modeled as a Command External system Time Domain Events Documents IT Operations (Gateway) Aggregate Read Model External Time Command Role Event Event Document IT Ops Read Model Aggregate 42. Thank you Jeppe Cramon [email protected] www.tigerteam.dk Twitter: @tigerteamdk and @jeppec Want to learn more? Contact me for training and mentoring