SlideShare a Scribd company logo
1 of 24
Tutti i nostri aggregati sono
sbagliati
Ovvero quando confondiamo accoppiamento e coesione
Il carrello della spesa
In apparenza tanto banale
Il carrello della spesa
Il mio fido porta-banana
Le informazioni chiave
Un perfetto aggregato
Data & Behavior
Un perfetto aggregato
Requisiti di business
Mauro Servienti
Trouble-solver @ Particular Software
mauro.servienti@particular.net
@mauroservienti
//blogs.ugidotnet.org/topics
Maledetti requisiti di business
Il nostro «perfetto» aggregato….
Availability
from Warehouse
New Price
from Sales
Il nostro «perfetto» aggregato….
Warehouse
Sales
Shipping
Marketing
Suppliers
!
!
in una parola
accoppiamento
a prescindere da come lo fate
Rich domain model (DDD)
It's focused on behaviors
and businesses rules.
Data it's just an effect of
those.
Concentratevi su chi
scrive e non su chi legge
Torniamo al carrello
AddItemToCartCommand
- CartId
- StockItemId
ShoppingCart Sales
ItemAddedToCart
- CartItemId
- StockItemId
Il carrello
•Il carrello è un processo
•Una «semplice» macchina a stati
•I servizi coinvolti sono coesi, non accoppiati
…e la quantità?
…e la quantità?
…e la quantità?
ChangeQuantity
- CartItemId
- Quantity
API Gateway
Shipping Sales
ChangeQuantity
- CartItemId
- Quantity
ChangeQuantity
- CartItemId
- Quantity
Shipping Sales
- CartTotalChanged
- ….
- AvailableShippingTypesChanged
- EligibilityForFreeShippingChanged
- ….
Concludendo
•Attenti all’accoppiamento, ma non odiatelo
•Abbracciamo la coesione, è nostra amica
•Concentriamoci su chi scrive, non chi legge
service
boundaries
Grazie!
Mauro Servienti
Trouble-solver @ Particular Software
mauro.servienti@particular.net
@mauroservienti
//blogs.ugidotnet.org/topics

More Related Content

Similar to Tutti i nostri aggregati sono sbagliati (K-Lab #3, 2017)

Reputazione e Sicurezza. Le Regole fondamentali per un E-Commerce di successo
Reputazione e Sicurezza. Le Regole fondamentali per un E-Commerce di successoReputazione e Sicurezza. Le Regole fondamentali per un E-Commerce di successo
Reputazione e Sicurezza. Le Regole fondamentali per un E-Commerce di successoAndrea Patron
 
Un e-commerce oltre confine: Intervista a Davide Giampà
Un e-commerce oltre confine: Intervista a Davide GiampàUn e-commerce oltre confine: Intervista a Davide Giampà
Un e-commerce oltre confine: Intervista a Davide GiampàFree Your Talent
 
3 consigli per trasformare una piccola attività in un business globale - Giu...
3 consigli per trasformare una piccola attività in un business globale - Giu...3 consigli per trasformare una piccola attività in un business globale - Giu...
3 consigli per trasformare una piccola attività in un business globale - Giu...Ecommerce HUB
 
SEO e marketing persuasivo per l'e-commerce
SEO e marketing persuasivo per l'e-commerce SEO e marketing persuasivo per l'e-commerce
SEO e marketing persuasivo per l'e-commerce FaberLab
 
SEO e marketing persuasivo per l'e-commerce
SEO e marketing persuasivo per l'e-commerceSEO e marketing persuasivo per l'e-commerce
SEO e marketing persuasivo per l'e-commerceAndrea Boscaro
 
8 consigli per migliorare il tuo eCommerce: scopri la Free Masterclass Ninja ...
8 consigli per migliorare il tuo eCommerce: scopri la Free Masterclass Ninja ...8 consigli per migliorare il tuo eCommerce: scopri la Free Masterclass Ninja ...
8 consigli per migliorare il tuo eCommerce: scopri la Free Masterclass Ninja ...Ninja Academy
 
e-Commerce: come progettare e costruire un canale di vendita online e come g...
 e-Commerce: come progettare e costruire un canale di vendita online e come g... e-Commerce: come progettare e costruire un canale di vendita online e come g...
e-Commerce: come progettare e costruire un canale di vendita online e come g...Giovanni Cappellotto
 
La vendita online tra paradigmi concorrenti, contenuti contro prezzi?
La vendita online tra paradigmi concorrenti, contenuti contro prezzi?La vendita online tra paradigmi concorrenti, contenuti contro prezzi?
La vendita online tra paradigmi concorrenti, contenuti contro prezzi?Contentware Hub
 
Istituzionale immediando new bis
Istituzionale  immediando new bisIstituzionale  immediando new bis
Istituzionale immediando new bisenomis82
 
I 10 punti chiave
I 10 punti chiaveI 10 punti chiave
I 10 punti chiaveSoloStocks
 
Gli eCommerce Trend del 2017: scopri il Corso Ninja Academy
Gli eCommerce Trend del 2017: scopri il Corso Ninja AcademyGli eCommerce Trend del 2017: scopri il Corso Ninja Academy
Gli eCommerce Trend del 2017: scopri il Corso Ninja AcademyNinja Academy
 
Avviare un e commerce con WordPress e Woocommerce
Avviare un e commerce con WordPress e WoocommerceAvviare un e commerce con WordPress e Woocommerce
Avviare un e commerce con WordPress e WoocommerceMarco De Sangro
 
Aprire un e-commerce Web to Print
Aprire un e-commerce Web to PrintAprire un e-commerce Web to Print
Aprire un e-commerce Web to PrintCarloalberto Baroni
 
PrestaShop Masterclass - 8 cose che devi sapere per migliorare il tuo eComme...
 PrestaShop Masterclass - 8 cose che devi sapere per migliorare il tuo eComme... PrestaShop Masterclass - 8 cose che devi sapere per migliorare il tuo eComme...
PrestaShop Masterclass - 8 cose che devi sapere per migliorare il tuo eComme...PrestaShop
 
SMAU NAPOLI 2022 | 6 Step per adottare l'Intelligenza Artificiale in azienda
SMAU NAPOLI 2022 | 6 Step per adottare l'Intelligenza Artificiale in aziendaSMAU NAPOLI 2022 | 6 Step per adottare l'Intelligenza Artificiale in azienda
SMAU NAPOLI 2022 | 6 Step per adottare l'Intelligenza Artificiale in aziendaSMAU
 
Analisi retail 2014
Analisi retail 2014Analisi retail 2014
Analisi retail 2014czalambani
 
7 Strategie di blogging esclusive per aumentare i clienti della tua azienda!
7 Strategie di blogging esclusive per aumentare i clienti della tua azienda!7 Strategie di blogging esclusive per aumentare i clienti della tua azienda!
7 Strategie di blogging esclusive per aumentare i clienti della tua azienda!Marketing Magnetico
 
SEO per E-Commerce - Conosciamo Google Panda
SEO per E-Commerce - Conosciamo Google PandaSEO per E-Commerce - Conosciamo Google Panda
SEO per E-Commerce - Conosciamo Google PandaIvano Di Biasi
 
La SEO per gli e-commerce
La SEO per gli e-commerceLa SEO per gli e-commerce
La SEO per gli e-commerceEcommerce HUB
 

Similar to Tutti i nostri aggregati sono sbagliati (K-Lab #3, 2017) (20)

Reputazione e Sicurezza. Le Regole fondamentali per un E-Commerce di successo
Reputazione e Sicurezza. Le Regole fondamentali per un E-Commerce di successoReputazione e Sicurezza. Le Regole fondamentali per un E-Commerce di successo
Reputazione e Sicurezza. Le Regole fondamentali per un E-Commerce di successo
 
Un e-commerce oltre confine: Intervista a Davide Giampà
Un e-commerce oltre confine: Intervista a Davide GiampàUn e-commerce oltre confine: Intervista a Davide Giampà
Un e-commerce oltre confine: Intervista a Davide Giampà
 
3 consigli per trasformare una piccola attività in un business globale - Giu...
3 consigli per trasformare una piccola attività in un business globale - Giu...3 consigli per trasformare una piccola attività in un business globale - Giu...
3 consigli per trasformare una piccola attività in un business globale - Giu...
 
9 eCommerce
9 eCommerce9 eCommerce
9 eCommerce
 
SEO e marketing persuasivo per l'e-commerce
SEO e marketing persuasivo per l'e-commerce SEO e marketing persuasivo per l'e-commerce
SEO e marketing persuasivo per l'e-commerce
 
SEO e marketing persuasivo per l'e-commerce
SEO e marketing persuasivo per l'e-commerceSEO e marketing persuasivo per l'e-commerce
SEO e marketing persuasivo per l'e-commerce
 
8 consigli per migliorare il tuo eCommerce: scopri la Free Masterclass Ninja ...
8 consigli per migliorare il tuo eCommerce: scopri la Free Masterclass Ninja ...8 consigli per migliorare il tuo eCommerce: scopri la Free Masterclass Ninja ...
8 consigli per migliorare il tuo eCommerce: scopri la Free Masterclass Ninja ...
 
e-Commerce: come progettare e costruire un canale di vendita online e come g...
 e-Commerce: come progettare e costruire un canale di vendita online e come g... e-Commerce: come progettare e costruire un canale di vendita online e come g...
e-Commerce: come progettare e costruire un canale di vendita online e come g...
 
La vendita online tra paradigmi concorrenti, contenuti contro prezzi?
La vendita online tra paradigmi concorrenti, contenuti contro prezzi?La vendita online tra paradigmi concorrenti, contenuti contro prezzi?
La vendita online tra paradigmi concorrenti, contenuti contro prezzi?
 
Istituzionale immediando new bis
Istituzionale  immediando new bisIstituzionale  immediando new bis
Istituzionale immediando new bis
 
I 10 punti chiave
I 10 punti chiaveI 10 punti chiave
I 10 punti chiave
 
Gli eCommerce Trend del 2017: scopri il Corso Ninja Academy
Gli eCommerce Trend del 2017: scopri il Corso Ninja AcademyGli eCommerce Trend del 2017: scopri il Corso Ninja Academy
Gli eCommerce Trend del 2017: scopri il Corso Ninja Academy
 
Avviare un e commerce con WordPress e Woocommerce
Avviare un e commerce con WordPress e WoocommerceAvviare un e commerce con WordPress e Woocommerce
Avviare un e commerce con WordPress e Woocommerce
 
Aprire un e-commerce Web to Print
Aprire un e-commerce Web to PrintAprire un e-commerce Web to Print
Aprire un e-commerce Web to Print
 
PrestaShop Masterclass - 8 cose che devi sapere per migliorare il tuo eComme...
 PrestaShop Masterclass - 8 cose che devi sapere per migliorare il tuo eComme... PrestaShop Masterclass - 8 cose che devi sapere per migliorare il tuo eComme...
PrestaShop Masterclass - 8 cose che devi sapere per migliorare il tuo eComme...
 
SMAU NAPOLI 2022 | 6 Step per adottare l'Intelligenza Artificiale in azienda
SMAU NAPOLI 2022 | 6 Step per adottare l'Intelligenza Artificiale in aziendaSMAU NAPOLI 2022 | 6 Step per adottare l'Intelligenza Artificiale in azienda
SMAU NAPOLI 2022 | 6 Step per adottare l'Intelligenza Artificiale in azienda
 
Analisi retail 2014
Analisi retail 2014Analisi retail 2014
Analisi retail 2014
 
7 Strategie di blogging esclusive per aumentare i clienti della tua azienda!
7 Strategie di blogging esclusive per aumentare i clienti della tua azienda!7 Strategie di blogging esclusive per aumentare i clienti della tua azienda!
7 Strategie di blogging esclusive per aumentare i clienti della tua azienda!
 
SEO per E-Commerce - Conosciamo Google Panda
SEO per E-Commerce - Conosciamo Google PandaSEO per E-Commerce - Conosciamo Google Panda
SEO per E-Commerce - Conosciamo Google Panda
 
La SEO per gli e-commerce
La SEO per gli e-commerceLa SEO per gli e-commerce
La SEO per gli e-commerce
 

More from Mauro Servienti

Welcome to the (state) machine @ ExploreDDD 2019
Welcome to the (state) machine @ ExploreDDD 2019Welcome to the (state) machine @ ExploreDDD 2019
Welcome to the (state) machine @ ExploreDDD 2019Mauro Servienti
 
Designing a ui for microservices @ .NET Day Switzerland 2019
Designing a ui for microservices @ .NET Day Switzerland 2019Designing a ui for microservices @ .NET Day Switzerland 2019
Designing a ui for microservices @ .NET Day Switzerland 2019Mauro Servienti
 
Welcome to the (state) machine @ Xe One Day Enterprise Applications
Welcome to the (state) machine @ Xe One Day Enterprise ApplicationsWelcome to the (state) machine @ Xe One Day Enterprise Applications
Welcome to the (state) machine @ Xe One Day Enterprise ApplicationsMauro Servienti
 
All our aggregates are wrong @ NDC Copenhagen 2019
All our aggregates are wrong @ NDC Copenhagen 2019All our aggregates are wrong @ NDC Copenhagen 2019
All our aggregates are wrong @ NDC Copenhagen 2019Mauro Servienti
 
Be like water, my friend @ Agile for Innovation 2019
Be like water, my friend @ Agile for Innovation 2019Be like water, my friend @ Agile for Innovation 2019
Be like water, my friend @ Agile for Innovation 2019Mauro Servienti
 
Microservices architecture is it the right choice to design long-living syste...
Microservices architecture is it the right choice to design long-living syste...Microservices architecture is it the right choice to design long-living syste...
Microservices architecture is it the right choice to design long-living syste...Mauro Servienti
 
Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019
Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019
Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019Mauro Servienti
 
Living organizations, particular software @ do IT Better Parma
Living organizations, particular software @ do IT Better ParmaLiving organizations, particular software @ do IT Better Parma
Living organizations, particular software @ do IT Better ParmaMauro Servienti
 
Welcome to the (state) machine @ Crafted Software
Welcome to the (state) machine @ Crafted SoftwareWelcome to the (state) machine @ Crafted Software
Welcome to the (state) machine @ Crafted SoftwareMauro Servienti
 
PO is dead, long live the PO - Italian Agile Day 2018
PO is dead, long live the PO - Italian Agile Day 2018PO is dead, long live the PO - Italian Agile Day 2018
PO is dead, long live the PO - Italian Agile Day 2018Mauro Servienti
 
Design a UI for your Microservices @ Do IT Better
Design a UI for your Microservices @ Do IT BetterDesign a UI for your Microservices @ Do IT Better
Design a UI for your Microservices @ Do IT BetterMauro Servienti
 
Microservices and pineapple on pizza what do they have in common - dos and ...
Microservices and pineapple on pizza   what do they have in common - dos and ...Microservices and pineapple on pizza   what do they have in common - dos and ...
Microservices and pineapple on pizza what do they have in common - dos and ...Mauro Servienti
 
All our aggregates are wrong (ExploreDDD 2018)
All our aggregates are wrong (ExploreDDD 2018)All our aggregates are wrong (ExploreDDD 2018)
All our aggregates are wrong (ExploreDDD 2018)Mauro Servienti
 
Designing a ui for microservices
Designing a ui for microservicesDesigning a ui for microservices
Designing a ui for microservicesMauro Servienti
 
Po is dead, long live the po
Po is dead, long live the poPo is dead, long live the po
Po is dead, long live the poMauro Servienti
 
Shipping code is not the problem, deciding what to ship it is!
Shipping code is not the problem, deciding what to ship it is!Shipping code is not the problem, deciding what to ship it is!
Shipping code is not the problem, deciding what to ship it is!Mauro Servienti
 
GraphQL - Where are you from? Where are you going?
GraphQL - Where are you from? Where are you going?GraphQL - Where are you from? Where are you going?
GraphQL - Where are you from? Where are you going?Mauro Servienti
 
Dall'idea al deploy un lungo viaggio che passa per git flow e semver
Dall'idea al deploy   un lungo viaggio che passa per git flow e semverDall'idea al deploy   un lungo viaggio che passa per git flow e semver
Dall'idea al deploy un lungo viaggio che passa per git flow e semverMauro Servienti
 
Progettare una UI per i Microservices
Progettare una UI per i MicroservicesProgettare una UI per i Microservices
Progettare una UI per i MicroservicesMauro Servienti
 
The road to a Service Oriented Architecture is paved with messages
The road to a Service Oriented Architecture is paved with messagesThe road to a Service Oriented Architecture is paved with messages
The road to a Service Oriented Architecture is paved with messagesMauro Servienti
 

More from Mauro Servienti (20)

Welcome to the (state) machine @ ExploreDDD 2019
Welcome to the (state) machine @ ExploreDDD 2019Welcome to the (state) machine @ ExploreDDD 2019
Welcome to the (state) machine @ ExploreDDD 2019
 
Designing a ui for microservices @ .NET Day Switzerland 2019
Designing a ui for microservices @ .NET Day Switzerland 2019Designing a ui for microservices @ .NET Day Switzerland 2019
Designing a ui for microservices @ .NET Day Switzerland 2019
 
Welcome to the (state) machine @ Xe One Day Enterprise Applications
Welcome to the (state) machine @ Xe One Day Enterprise ApplicationsWelcome to the (state) machine @ Xe One Day Enterprise Applications
Welcome to the (state) machine @ Xe One Day Enterprise Applications
 
All our aggregates are wrong @ NDC Copenhagen 2019
All our aggregates are wrong @ NDC Copenhagen 2019All our aggregates are wrong @ NDC Copenhagen 2019
All our aggregates are wrong @ NDC Copenhagen 2019
 
Be like water, my friend @ Agile for Innovation 2019
Be like water, my friend @ Agile for Innovation 2019Be like water, my friend @ Agile for Innovation 2019
Be like water, my friend @ Agile for Innovation 2019
 
Microservices architecture is it the right choice to design long-living syste...
Microservices architecture is it the right choice to design long-living syste...Microservices architecture is it the right choice to design long-living syste...
Microservices architecture is it the right choice to design long-living syste...
 
Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019
Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019
Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019
 
Living organizations, particular software @ do IT Better Parma
Living organizations, particular software @ do IT Better ParmaLiving organizations, particular software @ do IT Better Parma
Living organizations, particular software @ do IT Better Parma
 
Welcome to the (state) machine @ Crafted Software
Welcome to the (state) machine @ Crafted SoftwareWelcome to the (state) machine @ Crafted Software
Welcome to the (state) machine @ Crafted Software
 
PO is dead, long live the PO - Italian Agile Day 2018
PO is dead, long live the PO - Italian Agile Day 2018PO is dead, long live the PO - Italian Agile Day 2018
PO is dead, long live the PO - Italian Agile Day 2018
 
Design a UI for your Microservices @ Do IT Better
Design a UI for your Microservices @ Do IT BetterDesign a UI for your Microservices @ Do IT Better
Design a UI for your Microservices @ Do IT Better
 
Microservices and pineapple on pizza what do they have in common - dos and ...
Microservices and pineapple on pizza   what do they have in common - dos and ...Microservices and pineapple on pizza   what do they have in common - dos and ...
Microservices and pineapple on pizza what do they have in common - dos and ...
 
All our aggregates are wrong (ExploreDDD 2018)
All our aggregates are wrong (ExploreDDD 2018)All our aggregates are wrong (ExploreDDD 2018)
All our aggregates are wrong (ExploreDDD 2018)
 
Designing a ui for microservices
Designing a ui for microservicesDesigning a ui for microservices
Designing a ui for microservices
 
Po is dead, long live the po
Po is dead, long live the poPo is dead, long live the po
Po is dead, long live the po
 
Shipping code is not the problem, deciding what to ship it is!
Shipping code is not the problem, deciding what to ship it is!Shipping code is not the problem, deciding what to ship it is!
Shipping code is not the problem, deciding what to ship it is!
 
GraphQL - Where are you from? Where are you going?
GraphQL - Where are you from? Where are you going?GraphQL - Where are you from? Where are you going?
GraphQL - Where are you from? Where are you going?
 
Dall'idea al deploy un lungo viaggio che passa per git flow e semver
Dall'idea al deploy   un lungo viaggio che passa per git flow e semverDall'idea al deploy   un lungo viaggio che passa per git flow e semver
Dall'idea al deploy un lungo viaggio che passa per git flow e semver
 
Progettare una UI per i Microservices
Progettare una UI per i MicroservicesProgettare una UI per i Microservices
Progettare una UI per i Microservices
 
The road to a Service Oriented Architecture is paved with messages
The road to a Service Oriented Architecture is paved with messagesThe road to a Service Oriented Architecture is paved with messages
The road to a Service Oriented Architecture is paved with messages
 

Tutti i nostri aggregati sono sbagliati (K-Lab #3, 2017)