Alam aeki 2015

157
ALÅM AEKI guida illustrata all’esplorazione di un dominio con EventSourcing + EventStorming 5 Febbraio 2015 @ Apra Informatica - Jesi

Transcript of Alam aeki 2015

ALÅM AEKIguida illustrata all’esplorazione di un dominio con

EventSourcing + EventStorming

5 Febbraio 2015 @ Apra Informatica - Jesi

Agenda

Selfie Gatto

Citazione personaggio famoso

GIF AnimateCitazioni film

xkcd

Citazione letteraria

AgendaContesto

Problemi

Strumenti

Come siamo cambiati

@andreabalducci

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

Maggio 2013

Giugno 2013

Documentale

Enterprise Search

Calendari Personali e Condivisi

Ticket di assistenzaRichieste POS

Richieste WebBanking

Rubrica dinamica

Prenotazione attrezzature

Statistiche

Link Utili

Organigramma

Censimento IT

Single Sign-on

Pubblicazione ProdottiNotifiche pushChat

Scambio files

Fare tutto …

… per il primo rilascio …

… dobbiamo fare una sorpresa agli utenti.

Ricapitolando

Ricapitolando

Ambito applicativo esteso

Tempo limitato

Gruppo di lavoro ristretto

Switch “Big Bang” dai sistemi in uso

Cliente Enterprise

Prospettive ?

x nessun gatto ha subito maltrattamenti nella realizzazione di questa applicazione.

Consigli?

Ok, let’s do it!

So

che lo

state pensando

Iniziamo con qualcosa di semplice

Prenotazione attrezzature

“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

ResourceType ResourceUser Reservation

4 Aggregati

ResourceType

Resource

User

Reservation

Aggregati

Value Objects+

facile facile…

…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”

“E mo’ ?”

“Molte di quelle che chiamiamo difficoltà non ci paiono tali se non perché non ci vogliam torre la briga di cercare i mezzi, spesso molto semplici e maneggevoli, che basterebbero a superarle.”

Arturo Graf, Ecce Homo, 1908

“Molte di quelle che chiamiamo difficoltà non ci paiono tali se non perché non ci vogliam torre la briga di cercare i mezzi, spesso molto semplici e maneggevoli, che basterebbero a superarle.”

Arturo Graf, Ecce Homo, 1908

You can’t connect the dots looking forward;

you can only connect them looking backwards.

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

Event Storming

is a workshop format for

Event Storming

quickly exploring complex business domains

proviamo a cambiare il punto di vista

ALÅM AEKI

IKEA MÅLA

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 solo21,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

RichiestaApprovata

Attacchiamo i primi eventi disponendoli sull’asse temporale

RichiestaApprovata

RichiestaConfermata

RichiestaRespinta

Command

Indica l’intento dell’utente

Command

ApprovaRichiesta

Associamo ad ogni evento il comando relativo.

ApprovaRichiesta

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!!!

Le nostre “aggiunte”

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

Query

CommandBusiness Logic

Decision support system

Command

Query

EventEvent

Event

join the dots…

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()

Processmanager

Rappresenta un processo di business complesso

Processmanager

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

ApprovaRichiesta

RichiestaApprovata

Non sono ammesse prenotazioni sovrapposte per singola attrezzatura.

AssegnazioneAttrezzature

(process)

AttrezzatureDisponibili

(model)

ApprovaRichiesta

(command)

RichiestaApprovata

(event)

VietaPrenotazioniSovrapposte

(business rule)

BDD

       [Subject("with  a  deleted  handle")]          public  class  when_trying_to_delete_again  :  with_an_initialized_handle          {                  Establish  context  =  ()  =>  {  State.MarkAsDeleted();  };  

               Because  of  =  ()  =>  HandleAggregate.Delete();  

               It  HandleDeletedEvent_should_be_raised  =  ()  =>                          EventHasBeenRaised<HandleDeleted>().ShouldBeFalse();          }  

Machine.Specifications

Continuous Integration

TeamCity

Kanban

Continuous Delivery

ReadModel

NEventStore

IntranetAuthToolsCollaboration

DMS

ProcessManager

Projections

MVC WebApi

SignalR

DocumentStore

msg

query

pushhttp

write

eventcommand

CQRS + ES

Cosa abbiamo imparato?

Metriche

“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 Retrieval & Visualization Information System

grazie!

lanyrd.com/cchzbb

feedback => [email protected]