SlideShare a Scribd company logo
2017-04-07T09:30
E V E N T B A S E D
M O D E L L I N G
P R O T O T Y P I N G
&
Andrea Gian Maria Alessandro
Event based modelling and prototyping
Artigiani del software
Event based modelling and prototyping
FAIL FAST
Event based modelling and prototyping
Prenotazione
attrezzature
Event based modelling and prototyping
Event based modelling and prototyping
Event based modelling and prototyping
Event based modelling and prototyping
Event based modelling and prototyping
“Nothing surprises me;
I’m a scientist.”
ResourceTypes ResourcesUsers Reservations
4 Tabelle
Tabelle?
Non è DDD!
ResourceTypes ResourcesUsers Reservations
4 Tabelle
ResourceType ResourceUser Reservation
4 Aggregati
Event based modelling and prototyping
ResourceType ResourceUser Reservation
4 Aggregati
ResourceType
Resource
User
Reservation
Aggregati
Value Objects
+
Event based modelling and prototyping
“Non l’abbiamo
evidenziato perché è
scontato che il software
lo faccia”
“Dobbiamo fare un
sistema migliore del
precedente, con più
funzionalità”
Statistiche utente / risorsa / tipologia
L’auto è in officina
Il PC non è configurato
Alla fine di una riunione la sala deve essere pulita prima di essere
nuovamente disponibile
Gli utenti prenotano le attrezzature disponibili…
…e il nostro ufficio decide a chi darle.
Un utente può annullare una prenotazione…
…ma noi dobbiamo confermare l’annullamento.
Alcune richieste hanno precedenza su altre
La berlina è riservata al C.D.A.
Storico delle prenotazioni
Notifiche ad ogni evento
Aggiungiamo un flag
Storicizziamo il dato
Gestiamo l’eccezione
Iniettiamo un servizio…
Event based modelling and prototyping
“FIRST, SOLVE THE
PROBLEM
THEN WRITE THE CODE”John Johnson
is the most
important part of
the strategy.
ITERATION
It needs to be very,
very fast and
always based on
learning.
ALWAYS KEEP
LEARNING
You stop doing
useful things if you
don't learn.
Satya Nadella
Problem Model Code
Problem
Intent Action Reaction
EVENT EVENT EVENT EVENT
Timeline
INTENT
DECISION
SUPPORT
REACTIONEVENT EVENT
NOTIFICATION
Problem Space
EVENT EVENT EVENT EVENT
Stream
COMMAND
READ MODEL
PROCESSEVENT EVENT
SUBSCRIPTION
Solution Space
EVENT EVENT EVENT EVENT
Stream
COMMAND
READ MODEL
PROCESSEVENT EVENT
SUBSCRIPTION
EVENT EVENT EVENT EVENT
Timeline
INTENT
DECISION
SUPPORT
REACTIONEVENT EVENT
NOTIFICATION
Problem Space
Solution Space
PROBLEM
Event based modelling and prototyping
Event based modelling and prototyping
is a workshop format for
Event Storming
quickly exploring complex business domains
Il tempo scorre in questa direzione
Un pennarello a testa
Start!
Goal + KPI Goal + KPI Goal + KPI
Event
Rappresenta qualcosa di
significativo accaduto nel
dominio.
Event
Richiesta

Approvata
Attacchiamo i primi eventi disponendoli sull’asse temporale
Richiesta

Approvata
Richiesta

Confermata
Richiesta

Respinta
Command
Indica l’intento dell’utente
Command
Approva

Richiesta
Associamo ad ogni evento il comando relativo.
Approva

Richiesta
Event based modelling and prototyping
Read Model
Rappresenta il supporto
decisionale per l’utente
Read Model
Lista delle
attrezzature
disponibili
Il readmodel aiuta ad identificare le informazioni
necessarie all’utente per prendere decisioni
Lista delle attrezzature
disponibili
Ubiquitous
language
Definisce con precisione il
significato di ogni termine
Ubiquitous
language
Attrezzatura

Bene materiale
oggetto di
prenotazione
Attrezzatura

Bene materiale oggetto di
prenotazione
ambiguitàconvergenza sul significato dei termini
Problema smontato!
is a workshop format for
Event Storming
quickly exploring complex business domains
non compila!!!
MODEL
DOMAIN
DRIVEN
DESIGN
Un Domain Model non rappresenta la realtà,
la sua rappresentazione è funzionale
esclusivamente al caso d’uso.
https://www.theguardian.com/news/datablog/gallery/2013/jan/09/london-underground-alternative-tube-maps
Event based modelling and prototyping
ENTITY
Risorsa_1
Registrata
Abilitata
Prenotata
Consegnata
Resa
Bloccata
Dismessa
Risorsa_2
Registrata
Abilitata
Prenotata
Consegnata
Resa
Bloccata
Dismessa
VALUE OBJECT{
“Descrizione” : “Notebook”,
“Ram” : “16gb”
}
{
“Descrizione” : “Notebook”,
“Ram” : “16gb”
}
{
“Descrizione” : “Tablet”,
“Colore” : “Space Gray”
}
{
“Descrizione” : “Tablet”,
“Colore” : “Total Black”
}
{
“Descrizione” : “Notebook”,
“Ram” : “16gb”,
“Matricola” : “MB1039”
}
{
“Descrizione” : “Notebook”,
“Ram” : “16gb”,
“Matricola” : “MB1040”
}
AGGREGATE ROOT
Entity
Entity
Entity
Entity
Entity
Rule
Rule
Rule
value
object
value
object
value
object
value
object
FACTORY
REPOSITORY
Event Sourcing
“Capture all changes to an application state as a
sequence of events.”
Event Sourcing
http://martinfowler.com/eaaDev/EventSourcing.html
TimeRisorsa

Censita
Risorsa

resa
disponibile
Prenotazione

Inserita
Prenotazione

Approvata
Prenotazione

Inserita
Prenotazione

Confermata
Prenotazione

Non
Approvata
Risorsa

Dismessa
Risorsa

Censita
Risorsa

resa
disponibile
Prenotazione

Inserita
Prenotazione

Approvata
Prenotazione

Inserita
Prenotazione

Confermata
Prenotazione

Non
Approvata
Risorsa

Dismessa
Risorsa_1 Prenotazione_1 Prenotazione_2
Title : ”Budget 2014 - IT”,

LastModified : “2013-09-15”,

Tags : [],
Author: “Board of Directors”,
PublishedBy: null,

File: “Budget.xlsx”
Who: “Mr. Smith”,
Why: “DocumentCreated”,
When: “2013-09-15 18:35”,

What:{
Title : ”Budget 2014 - IT”,

Author: “Board of Directors”,
File: “Budget.xlsx”
}
Who: “Mary J.”,
Why: “RevisionAdded”,
When: “2013-09-16 09:40”,

What: {

File: “Budget with Costs.xlsx”

}
Who: “Mary J.”,
Why: “DocumentTagged”,
When: “2013-09-16 09:40”,

What: {

Tags : [“Draft”, “Accounting”]

}
Who: “Luther Blissett”,
Why: “RevisionAdded”,
When: “2013-12-06 21:35”,

What: {

File: “Budget with Costs & Sales Forecast.xlsx”
}
Who: “Luther Blissett”,
Why: “DocumentTagged”,
When: “2013-12-06 21:35”,

What: {

Tags : [“Budget”,”Sales”,“Accounting”]

}
Who: “Jane Doe”,
Why: “DocumentPublished”,
When: “2014-01-05 23:17”,

What : {

Title : “Budget 2014”

Tags : [“Budget”,”Sales”,“Accounting”]

}
TIME
Title : ”Budget 2014”,

LastModified : “2014-01-05”,

Tags : [“Budget”, “Sales”, “Accounting”],
Author: “Board of Directors”,
PublishedBy: “Jane Doe”,

File: “Budget with Costs & Sales Forecast.xlsx”
Title : ”Budget 2014 - IT”,

LastModified : “2013-09-16”,

Tags : [“Draft”, “Accounting”],
Author: “Board of Directors”,
PublishedBy: null,

File: “Budget with Costs.xlsx”
Title : ”Budget 2014 - IT”,

LastModified : “2013-12-06”,

Tags : [“Budget”,”Sales”,“Accounting”],
Author: “Board of Directors”,
PublishedBy: null,

File: “Budget with Costs & Sales Forecast.xlsx”
Information Loss
15
Settembre
2013
16
Settembre
2013
12
Dicembre
2013
5
Gennaio
2014
6
Maggio
2014
CQRS
CQRS
“At its heart is a simple notion that you can use a
different model to update information than the model you
use to read information”
http://martinfowler.com/bliki/CQRS.html
Business Logic
Decision support system
Event based modelling and prototyping
Business Logic
Decision support system
Business Logic
Decision support system
Query
Command
join the dots…
Query
Command
Read Model
Domain Model
Command
Read Model
Query
Domain Model
Read Model
Domain Model
Read Model
Application State
Aggregate
Command
Event
Event
Event
Read Model
Application State
Aggregate
Command Event
Event
Event
Read Model
Eventstream
Aggregate
Projection
Command
Event
Event
EventEvent
Read Model
Eventstream
Aggregate
Projection
Command
Event
Event
EventEvent
Query
DDD+CQRS+ES
EVENT EVENT EVENT EVENT EVENT
Timeline
COMMAND
READ MODEL
Action Mutation
PROCESS
Reaction
EVENT EVENT EVENT
Write Read
SUBSCRIPTION
MODELLATHON
Defrag
Aggreghiamo i post-it
Defrag
Event based modelling and prototyping
Aggregato Aggregato
Bounded Context
Aggregato
Bounded Context
Invarianti
Sono le regole che non
possiamo violare
Invarianti
Non sono ammesse
prenotazioni
sovrapposte per
singola attrezzatura.
Aggregato Aggregato
Bounded Context
Aggregato
Bounded Context
Non sono ammesse
prenotazioni sovrapposte
per singola attrezzatura.
Transizioni
Esploriamo le relazioni
tra comandi ed eventi
Transizioni
Aggregato Aggregato
Bounded Context
Aggregato
Bounded Context
Aggregato
Event based modelling and prototyping
if()
if()
Process

manager
Rappresenta un processo di
business complesso
Process

manager
Assegnazione
attrezzatura
Assegnazione
attrezzatura
Command Query Responsibility Segregation
Command
Process
Manager
Event
Event
Aggregate
Projections
Read
Model
Read
Model
Assegnazione
attrezzatura
CODE
Event based modelling and prototyping
Assegnazione
attrezzatura
Lista delle attrezzature
disponibili
Approva

Richiesta
Richiesta

Approvata
Non sono ammesse
prenotazioni sovrapposte
per singola attrezzatura.
AssegnazioneAttrezza
ture
(process)
AttrezzatureDisponibili
(model)
ApprovaRichiesta
(command)
RichiestaApprovata
(event)
VietaPrenotazioniSovrapposte
(business rule)

More Related Content

PDF
Open domus 2016
PDF
Alam aeki 2015
PDF
[Alam aeki] Guida illustrata alla modellazione di un dominio con Event Sourci...
PDF
Domain Driven Design e CQRS
PPT
Loosely Coupled Complexity - Unleash the power of your domain model
PDF
Conoscenza e promozione del territorio. La IULM per la Basilicata Turistica |...
PPTX
Introduzione al Domain Driven Design (DDD)
KEY
Stai guardando i dati sbagliati
Open domus 2016
Alam aeki 2015
[Alam aeki] Guida illustrata alla modellazione di un dominio con Event Sourci...
Domain Driven Design e CQRS
Loosely Coupled Complexity - Unleash the power of your domain model
Conoscenza e promozione del territorio. La IULM per la Basilicata Turistica |...
Introduzione al Domain Driven Design (DDD)
Stai guardando i dati sbagliati

Similar to Event based modelling and prototyping (20)

PDF
Never Mind the Bollocks: here's the Domain Driven Design
PDF
Layered Expression Trees feat. CQRS
PDF
Reshaping enterrprise software
PDF
Ricette veloci per Domain-Driven Design by Alberto Brandolini
PDF
Approccio Pratico al Domain Driven Design
PDF
L'illusione dell'ortogonalità
PDF
Lean anche io! No tu no! - Italian Agile Days 2013
PPTX
CCI 2019 - Exploiting Custom Vision SDK in Python to create an efficient imag...
PDF
[AxonIQ Italia Community] Architetture distribuite a eventi: sono adatte al m...
PPT
Software development industriale
PPT
C:\documents and settings\inzerillo\desktop\units\software development nel mo...
PPT
C:\documents and settings\inzerillo\desktop\units\software development nel mo...
PPTX
Lo sai che si può fare DDD in Javascript grazie a Typescript? Visual Studio e...
PDF
Idea - post-it - test verdi.
PPTX
Il web 2.0
PDF
How I did it (in .NET): idiomatic Domain Driven Design
PDF
Agile Experience Design & Development - IAD 2012
PPTX
Cloud, IoT and Big Data
PDF
Verso una gestione IT delle organizzazioni fondata sulla realtà
PDF
Innovare per le persone @ Smau2010
Never Mind the Bollocks: here's the Domain Driven Design
Layered Expression Trees feat. CQRS
Reshaping enterrprise software
Ricette veloci per Domain-Driven Design by Alberto Brandolini
Approccio Pratico al Domain Driven Design
L'illusione dell'ortogonalità
Lean anche io! No tu no! - Italian Agile Days 2013
CCI 2019 - Exploiting Custom Vision SDK in Python to create an efficient imag...
[AxonIQ Italia Community] Architetture distribuite a eventi: sono adatte al m...
Software development industriale
C:\documents and settings\inzerillo\desktop\units\software development nel mo...
C:\documents and settings\inzerillo\desktop\units\software development nel mo...
Lo sai che si può fare DDD in Javascript grazie a Typescript? Visual Studio e...
Idea - post-it - test verdi.
Il web 2.0
How I did it (in .NET): idiomatic Domain Driven Design
Agile Experience Design & Development - IAD 2012
Cloud, IoT and Big Data
Verso una gestione IT delle organizzazioni fondata sulla realtà
Innovare per le persone @ Smau2010
Ad

More from Andrea Balducci (14)

PDF
Agile Industry 4.0 - IoT Day 2019
PDF
Inception
PDF
Stranger Streams | NStore @ DevMarche
PDF
Storage dei dati con MongoDB
PDF
Italian Agile Days 2016 - Modellathon
PDF
Oktober webfest
PDF
TypeScript intro / mobile dev camp
PDF
Typescript intro
PDF
Mongo db halloween party
PDF
Event Sourcing con NEventStore
PDF
Intel AppUp Day Bologna
PPTX
Asp.Net MVC 2 :: VS 2010 Community Tour
PPTX
Introduzione ai framework ioc
PPTX
jQuery Ecosystem
Agile Industry 4.0 - IoT Day 2019
Inception
Stranger Streams | NStore @ DevMarche
Storage dei dati con MongoDB
Italian Agile Days 2016 - Modellathon
Oktober webfest
TypeScript intro / mobile dev camp
Typescript intro
Mongo db halloween party
Event Sourcing con NEventStore
Intel AppUp Day Bologna
Asp.Net MVC 2 :: VS 2010 Community Tour
Introduzione ai framework ioc
jQuery Ecosystem
Ad

Event based modelling and prototyping