beyond ddd: uno sguardo a cqrs and event sourcing
TRANSCRIPT
![Page 1: Beyond DDD: uno sguardo a CQRS and event sourcing](https://reader036.vdocuments.net/reader036/viewer/2022062319/554fad7fb4c905ad218b502c/html5/thumbnails/1.jpg)
Beyond DDD: uno sguardo a CQRS and event sourcing
![Page 2: Beyond DDD: uno sguardo a CQRS and event sourcing](https://reader036.vdocuments.net/reader036/viewer/2022062319/554fad7fb4c905ad218b502c/html5/thumbnails/2.jpg)
about me
{
"firstName": "Alessandro",
"lastName": "Melchiori",
"role": "software architect @ codiceplastico",
"contacts": [
{ "type": "email", "value": [email protected] },
{ "type": "twitter", "value": "@amelchiori" },
{ "type": "blog", "value": http://blog.codiceplastico.com/melkio }
]
}
![Page 3: Beyond DDD: uno sguardo a CQRS and event sourcing](https://reader036.vdocuments.net/reader036/viewer/2022062319/554fad7fb4c905ad218b502c/html5/thumbnails/3.jpg)
Il contesto• Applicazione finanziaria (non “always online”)
• Circa 70 utenti
• 250.000+ aziende
• 750.000+ bilanci
• 70.000.000+ voci di bilancio
• 16.000+ call/mese
• “Pluggato” a servizi di terze parti
• Picchi di lavoro “temporali” (…la nuvola può darci una mano)
![Page 4: Beyond DDD: uno sguardo a CQRS and event sourcing](https://reader036.vdocuments.net/reader036/viewer/2022062319/554fad7fb4c905ad218b502c/html5/thumbnails/4.jpg)
Agenda
• Com’era
• Com’è
• Come sarà
![Page 5: Beyond DDD: uno sguardo a CQRS and event sourcing](https://reader036.vdocuments.net/reader036/viewer/2022062319/554fad7fb4c905ad218b502c/html5/thumbnails/5.jpg)
Come era…Pr
esen
tatio
n La
yer
Serv
ice/
Appl
icati
on L
ayer
Dom
ain
Mod
el
Storage
![Page 6: Beyond DDD: uno sguardo a CQRS and event sourcing](https://reader036.vdocuments.net/reader036/viewer/2022062319/554fad7fb4c905ad218b502c/html5/thumbnails/6.jpg)
Come era…
![Page 7: Beyond DDD: uno sguardo a CQRS and event sourcing](https://reader036.vdocuments.net/reader036/viewer/2022062319/554fad7fb4c905ad218b502c/html5/thumbnails/7.jpg)
Come era…
![Page 8: Beyond DDD: uno sguardo a CQRS and event sourcing](https://reader036.vdocuments.net/reader036/viewer/2022062319/554fad7fb4c905ad218b502c/html5/thumbnails/8.jpg)
Come era…
![Page 9: Beyond DDD: uno sguardo a CQRS and event sourcing](https://reader036.vdocuments.net/reader036/viewer/2022062319/554fad7fb4c905ad218b502c/html5/thumbnails/9.jpg)
I problemi…
• Logica (mal) sparpagliata
• Contesti non definiti
• Modello “fragile” e poco propenso alle evoluzioni
• Un unico modello per la lettura e per la scrittura
• Prestazioni
• UI “generazionalista”
![Page 10: Beyond DDD: uno sguardo a CQRS and event sourcing](https://reader036.vdocuments.net/reader036/viewer/2022062319/554fad7fb4c905ad218b502c/html5/thumbnails/10.jpg)
DDD: brevi cenni
• Use AGGREGATES as unit of consistency across your domain model
• Protect your model with clearly defined BOUNDED CONTEXT
(Eric Evans)
BC 01 BC 02 BC 03
![Page 11: Beyond DDD: uno sguardo a CQRS and event sourcing](https://reader036.vdocuments.net/reader036/viewer/2022062319/554fad7fb4c905ad218b502c/html5/thumbnails/11.jpg)
DDD: brevi cenni
• It’s really become clear to me in the last couple of years that we need a new building block and that is the Domain Events
(Eric Evans)
BC 01 BC 02 BC 03
![Page 12: Beyond DDD: uno sguardo a CQRS and event sourcing](https://reader036.vdocuments.net/reader036/viewer/2022062319/554fad7fb4c905ad218b502c/html5/thumbnails/12.jpg)
CQRS / ES: brevi cenni
• Every method should either be a command that performs an action, or a query that returns data to the caller, but NOT BOTH
(Bertrand Meyer)
![Page 13: Beyond DDD: uno sguardo a CQRS and event sourcing](https://reader036.vdocuments.net/reader036/viewer/2022062319/554fad7fb4c905ad218b502c/html5/thumbnails/13.jpg)
CQRS / ES: brevi cenni
• A single model cannot be appropriate for reporting, searching and transactional behavior
• State transition are an important part of our problem space and should be modeled within our domain
(Greg Young, 2008)
![Page 14: Beyond DDD: uno sguardo a CQRS and event sourcing](https://reader036.vdocuments.net/reader036/viewer/2022062319/554fad7fb4c905ad218b502c/html5/thumbnails/14.jpg)
L’evoluzione
![Page 15: Beyond DDD: uno sguardo a CQRS and event sourcing](https://reader036.vdocuments.net/reader036/viewer/2022062319/554fad7fb4c905ad218b502c/html5/thumbnails/15.jpg)
Come è…Pr
esen
tatio
n La
yer
Serv
ice
Laye
r
Dom
ain
Mod
el
Write storage
Read storage
![Page 16: Beyond DDD: uno sguardo a CQRS and event sourcing](https://reader036.vdocuments.net/reader036/viewer/2022062319/554fad7fb4c905ad218b502c/html5/thumbnails/16.jpg)
Come sarà…
AZURE ?Service Bus
Blob Storage
Worker / Web Role
MongoDb (PaaS or SaaS)
ACS
![Page 17: Beyond DDD: uno sguardo a CQRS and event sourcing](https://reader036.vdocuments.net/reader036/viewer/2022062319/554fad7fb4c905ad218b502c/html5/thumbnails/17.jpg)
Quando DDD/CQRS/ES fanno per me?
Chiedilo al «tuo» UBIQUITOUS LANGUAGE
(Alessandro Melchiori)
![Page 18: Beyond DDD: uno sguardo a CQRS and event sourcing](https://reader036.vdocuments.net/reader036/viewer/2022062319/554fad7fb4c905ad218b502c/html5/thumbnails/18.jpg)
Quando DDD/CQRS/ES fanno per me?
Tackling Complexity in the Heart of Software