Event based modeling - eng

35
1 giovedì 23 maggio 13
  • date post

    18-Sep-2014
  • Category

    Technology

  • view

    5
  • download

    0

description

English version of the accompanying slide deck. But from now on I'll call it Event-Storming ;-)

Transcript of Event based modeling - eng

Page 1: Event based modeling - eng

1giovedì 23 maggio 13

Page 2: Event based modeling - eng

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

3giovedì 23 maggio 13

Page 4: Event based modeling - eng

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

Yes, I mean that much space...

5giovedì 23 maggio 13

Page 6: Event based modeling - eng

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

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

8giovedì 23 maggio 13

Page 9: Event based modeling - eng

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

10giovedì 23 maggio 13

Page 11: Event based modeling - eng

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

12giovedì 23 maggio 13

Page 13: Event based modeling - eng

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

14giovedì 23 maggio 13

Page 15: Event based modeling - eng

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

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

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

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

19giovedì 23 maggio 13

Page 20: Event based modeling - eng

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

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

22giovedì 23 maggio 13

Page 23: Event based modeling - eng

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

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

25giovedì 23 maggio 13

Page 26: Event based modeling - eng

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

27giovedì 23 maggio 13

Page 28: Event based modeling - eng

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

29giovedì 23 maggio 13

Page 30: Event based modeling - eng

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

31giovedì 23 maggio 13

Page 32: Event based modeling - eng

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

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

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

35giovedì 23 maggio 13