it could work!
30 Settembre 2016 @ Luiss EnLabs - Roma
guida illustrata ad

EventSourcing + EventStorming
Artigiani del software
Fine 2011
la tua software house sviluppa anche
Intranet aziendali?
per il 2012 pensavamo di implementarne una più moderna e dinamica
dell'attuale
la tua software house sviluppa anche
Intranet aziendali?
per il 2012 pensavamo di implementarne una più moderna e dinamica
dell'attuale
Intranet 2.0
10+
filiali
100+
utenti
250.000+
pagine
Interviste
UX
Giugno 2013
Documentale
Enterprise Search
Calendari Personali e Condivisi
Ticket di assistenza
Richieste POS
Richieste WebBanking
Rubrica dinamica
Prenotazione attrezzature
Statistiche
Link Utili
Organigramma
Censimento IT
Single Sign-on
Pubblicazione ProdottiNotifiche push
Chat
Scambio files
Fare tutto …
… per il primo rilascio …
… dobbiamo fare una
sorpresa agli utenti.
Iniziamo con qualcosa
di semplice
Prenotazione
attrezzature
“Nothing surprises me;
I’m a scientist.”
ResourceTypes ResourcesUsers Reservations
4 Tabelle
Tabelle?
Non è DDD!
Domain Driven Design
Domain Driven Design
ResourceTypes ResourcesUsers Reservations
4 Tabelle
ResourceType ResourceUser Reservation
4 Aggregati
ResourceType ResourceUser Reservation
4 Aggregati
ResourceType
Resource
User
Reservation
Aggregati
Value Objects
+
…ma…
(c’è sempre un ma)
“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…
“Iniziamo con
qualcosa di semplice”
Luglio 2013
La mia idea era quella di focalizzarci su Event Storming
o comunque su tecniche / trucchi / etc che facilitino la
modellazione di un dominio.
Sto modellando flussi come se non ci fosse un domani..
E’ necessaria una sala con almeno una superficie utile di
grandi dimensioni. Utilizzeremo rotoli di carta per la
visualizzazione dei flussi e per la costruzione del modello.
Ciao Brando, ho visto su slideshare del materiale che
hai pubblicato. Vorrei organizzare un workshop sulla
modellazione.
…the whole thing exploded in summer 2013.
While I realised there was a lot of value in it, other
practitioners (Mathias Verraes, Tom Janssen, Marco
Heimeshoff, Yves Reynhout, Tomas Jaskula,
Alessandro Colla, Andrea Balducci, Jef Claes, just to
name a few) started exploring and playing with the
format with amazing results, leading me to the
conclusion that this is something more than “just
another workshop format”.
http://ziobrando.blogspot.it/2013/11/introducing-event-storming.html
…the whole thing exploded in summer 2013.
While I realised there was a lot of value in it, other
practitioners (Mathias Verraes, Tom Janssen, Marco
Heimeshoff, Yves Reynhout, Tomas Jaskula,
Alessandro Colla, Andrea Balducci, Jef Claes, just to
name a few) started exploring and playing with the
format with amazing results, leading me to the
conclusion that this is something more than “just
another workshop format”.
http://ziobrando.blogspot.it/2013/11/introducing-event-storming.html
is a workshop format for
Event Storming
quickly exploring complex business domains
Le informazioni giuste..
http://blog.avanscoperta.it/it/2014/05/07/eventstorming-invite-the-right-people/
in poco tempo
valgono

un sacco*
* [sàc-co] s.m. - fig. fam. Ingente quantità, numero elevato
costano solo

21,87€*
* facilitatore non incluso nella confezione. Può creare Crea dipendenza.
Scegliete la parete più lunga
+
Il tempo scorre in questa direzione
Un pennarello a testa
Start!
Domain
Event
Rappresenta qualcosa di
significativo accaduto nel
dominio.
Domain
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
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!!!
#CODE
http://xkcd.com/844/
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”
Loss of Memory
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
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
PROJECTION
Action Mutation
PROCESS
Reaction
EVENT EVENT EVENT
Write Read
SUBSCRIPTION
il “nostro” Event Storming
Defrag
Aggreghiamo i post-it
Defrag
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
if()
if()
Process

manager
Rappresenta un processo di
business complesso
Process

manager
Policy?
Assegnazione
attrezzatura
Assegnazione
attrezzatura
Command Query Responsibility Segregation
Command
Process
Manager
Event
Event
Aggregate
Projections
Query
Model
Query
Model
Assegnazione
attrezzatura
Code well, code fast
Assegnazione
attrezzatura
Lista delle attrezzature
disponibili
Approva

Richiesta
Richiesta

Approvata
Non sono ammesse
prenotazioni sovrapposte
per singola attrezzatura.
AssegnazioneAttrezzature
(process)
AttrezzatureDisponibili
(model)
ApprovaRichiesta
(command)
RichiestaApprovata
(event)
VietaPrenotazioniSovrapposte
(business rule)
Cosa abbiamo imparato?
“Iteration is the
most important part
of the strategy.
It needs to be very,
very fast and
always based on
learning.”
Intranet 2.0
知識
Jarvis: Amazing, Reactive, Vast Information System
Give Back
The MIT License (MIT)
Copyright (c) 2016 Proximo srl
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
grazie!
feedback => andrea.balducci@prxm.it

Open domus 2016