際際滷

際際滷Share a Scribd company logo
Idiomatic Domain Driven Design: implementing CQRS
Idiomatic Domain Driven Design:
implementing CQRS
Andrea Saltarello
CEO @ managed/designs
andysal@gmail.com
http://twitter.com/andysal74
http://slideshare.net/andysal
Who I am
1. CEO @ Managed Designs, striving to discover the
perfect 束sustainable software development process損
 Customer has to be satisfied and pay
 Supplier has to have a reasonable markup
 Team members should be satisfied with their work
2. Founder and leader of UGIdotNET (first Italian .NET
User Group): I need to share experiences peer to peer
3. (Co)Author (together with Dino) of .NET: Architecting
Applications for the Enterprise, by Microsoft Press
4. Basically, a software developer
Whats DDD?
Domain Driven Design:
 Is not a methodology
 Is not an architecture
 Is not a silver bullet
 Is an approach aimed to tackle the complexity of software
development; its main assets are:
Bounded Context
Ubiquitous Language
Aggregates
(Events)
Ubiquitous Language
Its the language spoken by all the people that
work on a project; the UL spans from the
documentation to the source code.
Basically, technicians should adopt the language
spoken by the business in order to reduce
friction
Bounded Context
A Bounded Context is a bounduary whithin which a
specific ubiquitous language applies
A system is a composition (Map) of (bounded) contexts
(e.g.: web store, accountability, delivery&shipment ),
speaking one to each other by means of some kind of
API.
Due to the decoupling of contexts, we can use an ad hoc
architecture for every context
Aggregates
Aggregates are atomic clusters of objects that exist
and interact inside a specific BC: every Aggregate acts
as the (both) data and behaviour composition of an
important concept which exists within the BC itself.
 Basically, a DDD oriented system does coordinate
the work of aggregates
 The whole set of aggregates existing within a specific
BC is the BCs Domain Model.
 Should a specific behaviour exceed an Aggregates
bonduary, it will be implemented as a (Domain)
Service
 Model + Services == (Domain) Layer
Andrea vs. DDD, A.D. 2004
Got it: a system is a composition Map of
Bounded Contexts, each one sporting a Domain
Layer created after an Ubiquitous Language.
Awesome! Super Cool! Now How the hell can
we translate this in code?
2004: a Domain (Model) Odissey
DEMO
Domain Model (Voucher, NSK)
Is Domain Model broken?
Domain Model is (almost) ok, but to follow the
Blue Book style is pretty hard and requires a
lot of tradeoffs: is there a different way to have
the same approach applied?
DDD has twodistinct parts. You always need one and can
sometimes happily ignore the other.
Analytical
Strategic
Valuable to everybody and every project
Blue books Domain Model is just one supporting architecture,
though the one being originally recommended
Command Query Responsibility Segregation
A single model cannot be appropriate for
reporting, searching and transactional
behaviours
[Greg Young]
CQRS at a glance
Query Command
CQRS in a nutshell
束Doing CQRS損 means separating the stack that reads
data (query) from the one that can alter the systems
state (command), each one having its own ad hoc
束model損
All the actions that the system is capable of are
expressed as Commands. To sum it up:
1. A user An actor ask the system to execute a
command
2. Command execution alters the systems state
3. The read model is used in order to query for
(updated) data
Whats a 束MODEL損, anyway?
Were not trying to have a model which
faithfully represents the world, but one that
works within a bounded context
.Net DeveloperDays 2014
Mercator projection (1569)
.Net DeveloperDays 2014
Thats the world map were used to and Its wrong, but it
actually works (from a certain point of view)
Galls-Peters projection (1885  1973)
.Net DeveloperDays 2014
The Query side of the Force
The 束Read Model損 can be served in different flavours,
such as:
 Plain SQL
 (Micro) O/RM
 Services (xml, json, DTOs, )
 LET (Layered Expression Trees)
Layered Expression Trees (LET idiom)
As a business unit manager, I want to collect credits due to
unpaid outgoing invoices #ubiquitouslanguage #nuffsaid
Database.OutgoingInvoices.
.PerBusinessUnit(businessUnitId)
.ExpiredOnly()
.Select(i => new {InvoiceNumber = i.Number, CustomerId =
i.Customer.Id})
.AsParallel()
.ForAll(i => bus.Send(new
CollectDebtCommand(i.InvoiceNumber, i.CustomerId)));
DEMO
Layered Expression Trees
The Command side of the Force
Sorry, non silver bullet available for implementing
commands, too. Common choices:
 Transaction Script
 Event Sourcing (we will talk about this tomorrow)
CQRS feat. Transaction Script
Transaction Script
[P of EAA, 110]
Organizes business logic by procedures where each
procedure handles a single request from the
presentation.
Commands are 束modeled損 as functions, each one
representing one action that the system is capable of
DEMO
Transaction Script feat. CQRS
Next stop: Events. See you tomorrow 
It really became clear to me in the last couple of years
that we need a new building block and that is the
Domain Event.
[Eric Evans]
An event is something that has happened in the past.
[Greg Young]
A domain event  captures the memory of something
interesting which affects the domain
[Martin Fowler]
Bibliography
[DDD] Domain Driven Design, Eric Evans , Addison-Wesley
[NAAE] Microsoft .NET: Architecting Applications for the
Enterprise (2属 ed.), Andrea Saltarello & Dino Esposito,
Microsoft Press
[MERP] Merp, https://naa4e.codeplex.com/
Idiomatic Domain Driven Design: implementing CQRS

More Related Content

Similar to Idiomatic Domain Driven Design: implementing CQRS (20)

Domain Driven Design (DDD)
Domain Driven Design (DDD)Domain Driven Design (DDD)
Domain Driven Design (DDD)
Tom Kocjan
Domain-Driven Design (Artur Trosin Product Stream)
Domain-Driven Design (Artur Trosin Product Stream)Domain-Driven Design (Artur Trosin Product Stream)
Domain-Driven Design (Artur Trosin Product Stream)
IT Arena
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
Harsh Jegadeesan
Domain Driven Design - Distillation - Chapter 15
Domain Driven Design - Distillation - Chapter 15Domain Driven Design - Distillation - Chapter 15
Domain Driven Design - Distillation - Chapter 15
Mark Windholtz
Model Driven Architectures
Model Driven ArchitecturesModel Driven Architectures
Model Driven Architectures
Lalit Kale
Domain Driven Design - Building Blocks
Domain Driven Design - Building BlocksDomain Driven Design - Building Blocks
Domain Driven Design - Building Blocks
Mark Windholtz
Domain Driven Design Big Picture Strategic Patterns
Domain Driven Design Big Picture Strategic PatternsDomain Driven Design Big Picture Strategic Patterns
Domain Driven Design Big Picture Strategic Patterns
Mark Windholtz
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
Mojammel Haque
Brownfield Domain Driven Design
Brownfield Domain Driven DesignBrownfield Domain Driven Design
Brownfield Domain Driven Design
Nicol嘆 Pignatelli
Excavating the knowledge of our ancestors
Excavating the knowledge of our ancestorsExcavating the knowledge of our ancestors
Excavating the knowledge of our ancestors
Uwe Friedrichsen
Introduction to Domain-Driven Design
Introduction to Domain-Driven DesignIntroduction to Domain-Driven Design
Introduction to Domain-Driven Design
R-P-Azevedo
DDD In Agile
DDD In Agile   DDD In Agile
DDD In Agile
Skills Matter
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design Introduction
wojtek_s
Let's talk about... Microservices
Let's talk about... MicroservicesLet's talk about... Microservices
Let's talk about... Microservices
Alessandro Giorgetti
Sioux Hot-or-Not: Model Driven Software Development (Markus Voelter)
Sioux Hot-or-Not: Model Driven Software Development (Markus Voelter)Sioux Hot-or-Not: Model Driven Software Development (Markus Voelter)
Sioux Hot-or-Not: Model Driven Software Development (Markus Voelter)
siouxhotornot
Domain specific modelling (DSM)
Domain specific modelling (DSM)Domain specific modelling (DSM)
Domain specific modelling (DSM)
PG Scholar
Java TechTalk "Spring boot made life easier with Kubernetes and Microservices"
Java TechTalk "Spring boot made life easier with Kubernetes and Microservices"Java TechTalk "Spring boot made life easier with Kubernetes and Microservices"
Java TechTalk "Spring boot made life easier with Kubernetes and Microservices"
GlobalLogic Ukraine
An Introduction to Domain Driven Design in PHP
An Introduction to Domain Driven Design in PHPAn Introduction to Domain Driven Design in PHP
An Introduction to Domain Driven Design in PHP
Chris Renner
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
Muhammad Ali
Microservices Architecture
Microservices ArchitectureMicroservices Architecture
Microservices Architecture
Alessandro Giorgetti
Domain Driven Design (DDD)
Domain Driven Design (DDD)Domain Driven Design (DDD)
Domain Driven Design (DDD)
Tom Kocjan
Domain-Driven Design (Artur Trosin Product Stream)
Domain-Driven Design (Artur Trosin Product Stream)Domain-Driven Design (Artur Trosin Product Stream)
Domain-Driven Design (Artur Trosin Product Stream)
IT Arena
Domain Driven Design - Distillation - Chapter 15
Domain Driven Design - Distillation - Chapter 15Domain Driven Design - Distillation - Chapter 15
Domain Driven Design - Distillation - Chapter 15
Mark Windholtz
Model Driven Architectures
Model Driven ArchitecturesModel Driven Architectures
Model Driven Architectures
Lalit Kale
Domain Driven Design - Building Blocks
Domain Driven Design - Building BlocksDomain Driven Design - Building Blocks
Domain Driven Design - Building Blocks
Mark Windholtz
Domain Driven Design Big Picture Strategic Patterns
Domain Driven Design Big Picture Strategic PatternsDomain Driven Design Big Picture Strategic Patterns
Domain Driven Design Big Picture Strategic Patterns
Mark Windholtz
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
Mojammel Haque
Brownfield Domain Driven Design
Brownfield Domain Driven DesignBrownfield Domain Driven Design
Brownfield Domain Driven Design
Nicol嘆 Pignatelli
Excavating the knowledge of our ancestors
Excavating the knowledge of our ancestorsExcavating the knowledge of our ancestors
Excavating the knowledge of our ancestors
Uwe Friedrichsen
Introduction to Domain-Driven Design
Introduction to Domain-Driven DesignIntroduction to Domain-Driven Design
Introduction to Domain-Driven Design
R-P-Azevedo
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design Introduction
wojtek_s
Let's talk about... Microservices
Let's talk about... MicroservicesLet's talk about... Microservices
Let's talk about... Microservices
Alessandro Giorgetti
Sioux Hot-or-Not: Model Driven Software Development (Markus Voelter)
Sioux Hot-or-Not: Model Driven Software Development (Markus Voelter)Sioux Hot-or-Not: Model Driven Software Development (Markus Voelter)
Sioux Hot-or-Not: Model Driven Software Development (Markus Voelter)
siouxhotornot
Domain specific modelling (DSM)
Domain specific modelling (DSM)Domain specific modelling (DSM)
Domain specific modelling (DSM)
PG Scholar
Java TechTalk "Spring boot made life easier with Kubernetes and Microservices"
Java TechTalk "Spring boot made life easier with Kubernetes and Microservices"Java TechTalk "Spring boot made life easier with Kubernetes and Microservices"
Java TechTalk "Spring boot made life easier with Kubernetes and Microservices"
GlobalLogic Ukraine
An Introduction to Domain Driven Design in PHP
An Introduction to Domain Driven Design in PHPAn Introduction to Domain Driven Design in PHP
An Introduction to Domain Driven Design in PHP
Chris Renner
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
Muhammad Ali

More from Andrea Saltarello (12)

Da Rotor a .NET Core ed indietro: Microsoft <3 Open Source
Da Rotor a .NET Core ed indietro: Microsoft <3 Open SourceDa Rotor a .NET Core ed indietro: Microsoft <3 Open Source
Da Rotor a .NET Core ed indietro: Microsoft <3 Open Source
Andrea Saltarello
ASP.NET Core essentials
ASP.NET Core essentialsASP.NET Core essentials
ASP.NET Core essentials
Andrea Saltarello
Never Mind the Bollocks: here's the Domain Driven Design
Never Mind the Bollocks: here's the Domain Driven DesignNever Mind the Bollocks: here's the Domain Driven Design
Never Mind the Bollocks: here's the Domain Driven Design
Andrea Saltarello
Layered Expression Trees feat. CQRS
Layered Expression Trees feat. CQRSLayered Expression Trees feat. CQRS
Layered Expression Trees feat. CQRS
Andrea Saltarello
How I did it (in .NET): idiomatic Domain Driven Design
How I did it (in .NET): idiomatic Domain Driven DesignHow I did it (in .NET): idiomatic Domain Driven Design
How I did it (in .NET): idiomatic Domain Driven Design
Andrea Saltarello
ASP.NET MVC: Full Throttle
ASP.NET MVC: Full ThrottleASP.NET MVC: Full Throttle
ASP.NET MVC: Full Throttle
Andrea Saltarello
Code Contracts and Generics: implementing a LINQ-enabled Repository
Code Contracts and Generics: implementing a LINQ-enabled RepositoryCode Contracts and Generics: implementing a LINQ-enabled Repository
Code Contracts and Generics: implementing a LINQ-enabled Repository
Andrea Saltarello
Idiomatic Domain Driven Design
Idiomatic Domain Driven DesignIdiomatic Domain Driven Design
Idiomatic Domain Driven Design
Andrea Saltarello
Build a LINQ-enabled Repository
Build a LINQ-enabled RepositoryBuild a LINQ-enabled Repository
Build a LINQ-enabled Repository
Andrea Saltarello
Layered Expression Trees: una terza via (idiomatica) verso il DDD
Layered Expression Trees: una terza via (idiomatica) verso il DDDLayered Expression Trees: una terza via (idiomatica) verso il DDD
Layered Expression Trees: una terza via (idiomatica) verso il DDD
Andrea Saltarello
From relational data to object spaces
From relational data to object spacesFrom relational data to object spaces
From relational data to object spaces
Andrea Saltarello
MVC2: non solo tecnologia
MVC2: non solo tecnologiaMVC2: non solo tecnologia
MVC2: non solo tecnologia
Andrea Saltarello
Da Rotor a .NET Core ed indietro: Microsoft <3 Open Source
Da Rotor a .NET Core ed indietro: Microsoft <3 Open SourceDa Rotor a .NET Core ed indietro: Microsoft <3 Open Source
Da Rotor a .NET Core ed indietro: Microsoft <3 Open Source
Andrea Saltarello
Never Mind the Bollocks: here's the Domain Driven Design
Never Mind the Bollocks: here's the Domain Driven DesignNever Mind the Bollocks: here's the Domain Driven Design
Never Mind the Bollocks: here's the Domain Driven Design
Andrea Saltarello
Layered Expression Trees feat. CQRS
Layered Expression Trees feat. CQRSLayered Expression Trees feat. CQRS
Layered Expression Trees feat. CQRS
Andrea Saltarello
How I did it (in .NET): idiomatic Domain Driven Design
How I did it (in .NET): idiomatic Domain Driven DesignHow I did it (in .NET): idiomatic Domain Driven Design
How I did it (in .NET): idiomatic Domain Driven Design
Andrea Saltarello
ASP.NET MVC: Full Throttle
ASP.NET MVC: Full ThrottleASP.NET MVC: Full Throttle
ASP.NET MVC: Full Throttle
Andrea Saltarello
Code Contracts and Generics: implementing a LINQ-enabled Repository
Code Contracts and Generics: implementing a LINQ-enabled RepositoryCode Contracts and Generics: implementing a LINQ-enabled Repository
Code Contracts and Generics: implementing a LINQ-enabled Repository
Andrea Saltarello
Idiomatic Domain Driven Design
Idiomatic Domain Driven DesignIdiomatic Domain Driven Design
Idiomatic Domain Driven Design
Andrea Saltarello
Build a LINQ-enabled Repository
Build a LINQ-enabled RepositoryBuild a LINQ-enabled Repository
Build a LINQ-enabled Repository
Andrea Saltarello
Layered Expression Trees: una terza via (idiomatica) verso il DDD
Layered Expression Trees: una terza via (idiomatica) verso il DDDLayered Expression Trees: una terza via (idiomatica) verso il DDD
Layered Expression Trees: una terza via (idiomatica) verso il DDD
Andrea Saltarello
From relational data to object spaces
From relational data to object spacesFrom relational data to object spaces
From relational data to object spaces
Andrea Saltarello
MVC2: non solo tecnologia
MVC2: non solo tecnologiaMVC2: non solo tecnologia
MVC2: non solo tecnologia
Andrea Saltarello

Recently uploaded (20)

IObit Driver Booster Free 12.3.0.557 Free Download
IObit Driver Booster Free 12.3.0.557 Free DownloadIObit Driver Booster Free 12.3.0.557 Free Download
IObit Driver Booster Free 12.3.0.557 Free Download
blouch33kp
The Evolution of Microsoft Project Portfolio Management
The Evolution of Microsoft Project Portfolio ManagementThe Evolution of Microsoft Project Portfolio Management
The Evolution of Microsoft Project Portfolio Management
OnePlan Solutions
Movavi Screen Recorder Studio 2025 crack Free Download
Movavi Screen Recorder Studio 2025 crack Free DownloadMovavi Screen Recorder Studio 2025 crack Free Download
Movavi Screen Recorder Studio 2025 crack Free Download
imran03kr
Multicompany Analytic Odoo Dashboard for POS, CRM, Inventory, Sales and Accou...
Multicompany Analytic Odoo Dashboard for POS, CRM, Inventory, Sales and Accou...Multicompany Analytic Odoo Dashboard for POS, CRM, Inventory, Sales and Accou...
Multicompany Analytic Odoo Dashboard for POS, CRM, Inventory, Sales and Accou...
AxisTechnolabs
Windows 8.1 Pro Activator Crack Version [April-2025]
Windows 8.1 Pro Activator Crack Version [April-2025]Windows 8.1 Pro Activator Crack Version [April-2025]
Windows 8.1 Pro Activator Crack Version [April-2025]
jhonjosh91
Internet Download Manager Crack Latest version 2025
Internet Download Manager  Crack Latest version 2025Internet Download Manager  Crack Latest version 2025
Internet Download Manager Crack Latest version 2025
mohsinrazakpa26
The Missing Voices: Unearthing the Impact of Survivorship Bias on Women in Te...
The Missing Voices: Unearthing the Impact of Survivorship Bias on Women in Te...The Missing Voices: Unearthing the Impact of Survivorship Bias on Women in Te...
The Missing Voices: Unearthing the Impact of Survivorship Bias on Women in Te...
Imma Valls Bernaus
Clip Studio Paint EX Download (Latest 2025)
Clip Studio Paint EX Download (Latest 2025)Clip Studio Paint EX Download (Latest 2025)
Clip Studio Paint EX Download (Latest 2025)
mohsinrazakpa79
Oracle Database administration Security PPT
Oracle Database administration Security PPTOracle Database administration Security PPT
Oracle Database administration Security PPT
pshankarnarayan
Wondershare Filmora Crack 2025 For Windows Free
Wondershare Filmora Crack 2025 For Windows FreeWondershare Filmora Crack 2025 For Windows Free
Wondershare Filmora Crack 2025 For Windows Free
mohsinrazakpa43
Adobe XD Crack Version 2025 Free Download
Adobe XD Crack Version 2025 Free DownloadAdobe XD Crack Version 2025 Free Download
Adobe XD Crack Version 2025 Free Download
mohsinrazakpa67
Driver Genius 24 Crack 2025 License Key Free Download
Driver Genius 24 Crack 2025 License Key Free DownloadDriver Genius 24 Crack 2025 License Key Free Download
Driver Genius 24 Crack 2025 License Key Free Download
umeerbinfaizan
Byteexpo Call Center - Presentation.pptx
Byteexpo Call Center - Presentation.pptxByteexpo Call Center - Presentation.pptx
Byteexpo Call Center - Presentation.pptx
hmk11790
Wondershare Filmora 14.3.2 Crack + License Key Free Download
Wondershare Filmora 14.3.2 Crack + License Key Free DownloadWondershare Filmora 14.3.2 Crack + License Key Free Download
Wondershare Filmora 14.3.2 Crack + License Key Free Download
anglekaan18
Digital Application Development Services
Digital Application Development ServicesDigital Application Development Services
Digital Application Development Services
daavishenry
microsoft office 2019 crack free download
microsoft office 2019 crack free downloadmicrosoft office 2019 crack free download
microsoft office 2019 crack free download
mohsinrazakpa39
Alluxio Webinar | Inside Deepseek 3FS: A Deep Dive into AI-Optimized Distribu...
Alluxio Webinar | Inside Deepseek 3FS: A Deep Dive into AI-Optimized Distribu...Alluxio Webinar | Inside Deepseek 3FS: A Deep Dive into AI-Optimized Distribu...
Alluxio Webinar | Inside Deepseek 3FS: A Deep Dive into AI-Optimized Distribu...
Alluxio, Inc.
Wondershare Filmora 14.3.2.11147 crack
Wondershare Filmora   14.3.2.11147 crackWondershare Filmora   14.3.2.11147 crack
Wondershare Filmora 14.3.2.11147 crack
blouch51kp
Migrating GitHub Actions with Nested Virtualization to Cloud Native Ecosystem...
Migrating GitHub Actions with Nested Virtualization to Cloud Native Ecosystem...Migrating GitHub Actions with Nested Virtualization to Cloud Native Ecosystem...
Migrating GitHub Actions with Nested Virtualization to Cloud Native Ecosystem...
KCD Guadalajara
TVersity Pro Media Server Free CRACK Download
TVersity Pro Media Server Free CRACK DownloadTVersity Pro Media Server Free CRACK Download
TVersity Pro Media Server Free CRACK Download
mohsinrazakpa43
IObit Driver Booster Free 12.3.0.557 Free Download
IObit Driver Booster Free 12.3.0.557 Free DownloadIObit Driver Booster Free 12.3.0.557 Free Download
IObit Driver Booster Free 12.3.0.557 Free Download
blouch33kp
The Evolution of Microsoft Project Portfolio Management
The Evolution of Microsoft Project Portfolio ManagementThe Evolution of Microsoft Project Portfolio Management
The Evolution of Microsoft Project Portfolio Management
OnePlan Solutions
Movavi Screen Recorder Studio 2025 crack Free Download
Movavi Screen Recorder Studio 2025 crack Free DownloadMovavi Screen Recorder Studio 2025 crack Free Download
Movavi Screen Recorder Studio 2025 crack Free Download
imran03kr
Multicompany Analytic Odoo Dashboard for POS, CRM, Inventory, Sales and Accou...
Multicompany Analytic Odoo Dashboard for POS, CRM, Inventory, Sales and Accou...Multicompany Analytic Odoo Dashboard for POS, CRM, Inventory, Sales and Accou...
Multicompany Analytic Odoo Dashboard for POS, CRM, Inventory, Sales and Accou...
AxisTechnolabs
Windows 8.1 Pro Activator Crack Version [April-2025]
Windows 8.1 Pro Activator Crack Version [April-2025]Windows 8.1 Pro Activator Crack Version [April-2025]
Windows 8.1 Pro Activator Crack Version [April-2025]
jhonjosh91
Internet Download Manager Crack Latest version 2025
Internet Download Manager  Crack Latest version 2025Internet Download Manager  Crack Latest version 2025
Internet Download Manager Crack Latest version 2025
mohsinrazakpa26
The Missing Voices: Unearthing the Impact of Survivorship Bias on Women in Te...
The Missing Voices: Unearthing the Impact of Survivorship Bias on Women in Te...The Missing Voices: Unearthing the Impact of Survivorship Bias on Women in Te...
The Missing Voices: Unearthing the Impact of Survivorship Bias on Women in Te...
Imma Valls Bernaus
Clip Studio Paint EX Download (Latest 2025)
Clip Studio Paint EX Download (Latest 2025)Clip Studio Paint EX Download (Latest 2025)
Clip Studio Paint EX Download (Latest 2025)
mohsinrazakpa79
Oracle Database administration Security PPT
Oracle Database administration Security PPTOracle Database administration Security PPT
Oracle Database administration Security PPT
pshankarnarayan
Wondershare Filmora Crack 2025 For Windows Free
Wondershare Filmora Crack 2025 For Windows FreeWondershare Filmora Crack 2025 For Windows Free
Wondershare Filmora Crack 2025 For Windows Free
mohsinrazakpa43
Adobe XD Crack Version 2025 Free Download
Adobe XD Crack Version 2025 Free DownloadAdobe XD Crack Version 2025 Free Download
Adobe XD Crack Version 2025 Free Download
mohsinrazakpa67
Driver Genius 24 Crack 2025 License Key Free Download
Driver Genius 24 Crack 2025 License Key Free DownloadDriver Genius 24 Crack 2025 License Key Free Download
Driver Genius 24 Crack 2025 License Key Free Download
umeerbinfaizan
Byteexpo Call Center - Presentation.pptx
Byteexpo Call Center - Presentation.pptxByteexpo Call Center - Presentation.pptx
Byteexpo Call Center - Presentation.pptx
hmk11790
Wondershare Filmora 14.3.2 Crack + License Key Free Download
Wondershare Filmora 14.3.2 Crack + License Key Free DownloadWondershare Filmora 14.3.2 Crack + License Key Free Download
Wondershare Filmora 14.3.2 Crack + License Key Free Download
anglekaan18
Digital Application Development Services
Digital Application Development ServicesDigital Application Development Services
Digital Application Development Services
daavishenry
microsoft office 2019 crack free download
microsoft office 2019 crack free downloadmicrosoft office 2019 crack free download
microsoft office 2019 crack free download
mohsinrazakpa39
Alluxio Webinar | Inside Deepseek 3FS: A Deep Dive into AI-Optimized Distribu...
Alluxio Webinar | Inside Deepseek 3FS: A Deep Dive into AI-Optimized Distribu...Alluxio Webinar | Inside Deepseek 3FS: A Deep Dive into AI-Optimized Distribu...
Alluxio Webinar | Inside Deepseek 3FS: A Deep Dive into AI-Optimized Distribu...
Alluxio, Inc.
Wondershare Filmora 14.3.2.11147 crack
Wondershare Filmora   14.3.2.11147 crackWondershare Filmora   14.3.2.11147 crack
Wondershare Filmora 14.3.2.11147 crack
blouch51kp
Migrating GitHub Actions with Nested Virtualization to Cloud Native Ecosystem...
Migrating GitHub Actions with Nested Virtualization to Cloud Native Ecosystem...Migrating GitHub Actions with Nested Virtualization to Cloud Native Ecosystem...
Migrating GitHub Actions with Nested Virtualization to Cloud Native Ecosystem...
KCD Guadalajara
TVersity Pro Media Server Free CRACK Download
TVersity Pro Media Server Free CRACK DownloadTVersity Pro Media Server Free CRACK Download
TVersity Pro Media Server Free CRACK Download
mohsinrazakpa43

Idiomatic Domain Driven Design: implementing CQRS

  • 2. Idiomatic Domain Driven Design: implementing CQRS Andrea Saltarello CEO @ managed/designs andysal@gmail.com http://twitter.com/andysal74 http://slideshare.net/andysal
  • 3. Who I am 1. CEO @ Managed Designs, striving to discover the perfect 束sustainable software development process損 Customer has to be satisfied and pay Supplier has to have a reasonable markup Team members should be satisfied with their work 2. Founder and leader of UGIdotNET (first Italian .NET User Group): I need to share experiences peer to peer 3. (Co)Author (together with Dino) of .NET: Architecting Applications for the Enterprise, by Microsoft Press 4. Basically, a software developer
  • 4. Whats DDD? Domain Driven Design: Is not a methodology Is not an architecture Is not a silver bullet Is an approach aimed to tackle the complexity of software development; its main assets are: Bounded Context Ubiquitous Language Aggregates (Events)
  • 5. Ubiquitous Language Its the language spoken by all the people that work on a project; the UL spans from the documentation to the source code. Basically, technicians should adopt the language spoken by the business in order to reduce friction
  • 6. Bounded Context A Bounded Context is a bounduary whithin which a specific ubiquitous language applies A system is a composition (Map) of (bounded) contexts (e.g.: web store, accountability, delivery&shipment ), speaking one to each other by means of some kind of API. Due to the decoupling of contexts, we can use an ad hoc architecture for every context
  • 7. Aggregates Aggregates are atomic clusters of objects that exist and interact inside a specific BC: every Aggregate acts as the (both) data and behaviour composition of an important concept which exists within the BC itself. Basically, a DDD oriented system does coordinate the work of aggregates The whole set of aggregates existing within a specific BC is the BCs Domain Model. Should a specific behaviour exceed an Aggregates bonduary, it will be implemented as a (Domain) Service Model + Services == (Domain) Layer
  • 8. Andrea vs. DDD, A.D. 2004 Got it: a system is a composition Map of Bounded Contexts, each one sporting a Domain Layer created after an Ubiquitous Language. Awesome! Super Cool! Now How the hell can we translate this in code?
  • 9. 2004: a Domain (Model) Odissey
  • 11. Is Domain Model broken? Domain Model is (almost) ok, but to follow the Blue Book style is pretty hard and requires a lot of tradeoffs: is there a different way to have the same approach applied?
  • 12. DDD has twodistinct parts. You always need one and can sometimes happily ignore the other. Analytical Strategic Valuable to everybody and every project Blue books Domain Model is just one supporting architecture, though the one being originally recommended
  • 13. Command Query Responsibility Segregation A single model cannot be appropriate for reporting, searching and transactional behaviours [Greg Young]
  • 14. CQRS at a glance Query Command
  • 15. CQRS in a nutshell 束Doing CQRS損 means separating the stack that reads data (query) from the one that can alter the systems state (command), each one having its own ad hoc 束model損 All the actions that the system is capable of are expressed as Commands. To sum it up: 1. A user An actor ask the system to execute a command 2. Command execution alters the systems state 3. The read model is used in order to query for (updated) data
  • 16. Whats a 束MODEL損, anyway? Were not trying to have a model which faithfully represents the world, but one that works within a bounded context .Net DeveloperDays 2014
  • 17. Mercator projection (1569) .Net DeveloperDays 2014 Thats the world map were used to and Its wrong, but it actually works (from a certain point of view)
  • 18. Galls-Peters projection (1885 1973) .Net DeveloperDays 2014
  • 19. The Query side of the Force The 束Read Model損 can be served in different flavours, such as: Plain SQL (Micro) O/RM Services (xml, json, DTOs, ) LET (Layered Expression Trees)
  • 20. Layered Expression Trees (LET idiom) As a business unit manager, I want to collect credits due to unpaid outgoing invoices #ubiquitouslanguage #nuffsaid Database.OutgoingInvoices. .PerBusinessUnit(businessUnitId) .ExpiredOnly() .Select(i => new {InvoiceNumber = i.Number, CustomerId = i.Customer.Id}) .AsParallel() .ForAll(i => bus.Send(new CollectDebtCommand(i.InvoiceNumber, i.CustomerId)));
  • 22. The Command side of the Force Sorry, non silver bullet available for implementing commands, too. Common choices: Transaction Script Event Sourcing (we will talk about this tomorrow)
  • 23. CQRS feat. Transaction Script Transaction Script [P of EAA, 110] Organizes business logic by procedures where each procedure handles a single request from the presentation. Commands are 束modeled損 as functions, each one representing one action that the system is capable of
  • 25. Next stop: Events. See you tomorrow It really became clear to me in the last couple of years that we need a new building block and that is the Domain Event. [Eric Evans] An event is something that has happened in the past. [Greg Young] A domain event captures the memory of something interesting which affects the domain [Martin Fowler]
  • 26. Bibliography [DDD] Domain Driven Design, Eric Evans , Addison-Wesley [NAAE] Microsoft .NET: Architecting Applications for the Enterprise (2属 ed.), Andrea Saltarello & Dino Esposito, Microsoft Press [MERP] Merp, https://naa4e.codeplex.com/