ݺߣ

ݺߣShare a Scribd company logo
IntroductionCQRSPieter Joost van de Sande
Introduction to CQRS
Thank you VSOFT!!
AgendaHow we do things now
What CQRS changes to that
Building a CQRS architecture
Some demo stuff
Discussion
Beer!TypicalarchitecturesYou should recognize this
Typical architectures
Typical architecturesPresentationDomainData
N-LayerFlexible – we could replace a layer without breaking much.
Simple separation that is easy to explain.
Higher abstraction with each layer.
Known by a lot of people.
Supportedby tools andframeworks
Lots of resources availableWhat the n-tier tunnel brought us
Typical architectures
TWO fundamental thingsEvery system has this
data
Transitions
What is CQRS?COMMANDQUERYRESPONSIBILITYSEGREGATION
Cqrs ConceptMove from N-layer to…
N-LAYERarchitecturePresentationDomainData
PresentationDomainData
PresentationDomainData
PresentationDomainData
PresentationReadState transitionsDomainData
fromCQRS ConcepttoarchitectureThis adds more value!
Introduction to CQRS
User interface
Demand for dataBecause we have some screens to fill
WE read a lot
WE have multiple screens to fill
Data should be close to us
Demandfor dataUser interface has different views tofill.
It shouldnot have toexecute business rules on the data.
It requests data manytimes.
It shouldbe close tous.
Getting data shouldbesimple (select * from x where y)Examples:Get all products of user XGet total price of all orders of month May
User interface
Read sideUser interface
Read sideRead databasesUser interface
Read sideRead databasesqueryUser interface
Read sideThe only need it has to serve is reading.Do we need an relational data here?
Contains the data in an form we need
Facades should be minimized
Read models do not have to be on one location...
They should be close to the clientRead sideRead databasesqueryUser interface
Demand for changeOtherwise things are static
I want to tell the system somethingPlease move customer X to this new address
Change has intentUsers don’t make changes for nothing.This intent has value!Correct the address for user XCustomer X moved to new addressVS.
Multiple stepsUsers can take multiple steps before they reach the end goal. These steps can be very useful to us.
CommandsModel that is optimized the describe changes.
Commands contain all the data needed to execute the underlying action.
Contain the intent of the change.Examples:AddProductToShoppingCartPurchaseOrderMoveUserToNewAddressCorrectAddressForUser
Read sideRead databasesqueryUser interface
Read sideWrite sideRead databasesqueryUser interface
Read sideWrite sideRead databasesCommandhandlerscommandsqueryUser interface
Read sideWrite sideRead databasesFacadeDomainCommandhandlerscommandsDTO’sUser interface
Greg Young:“State transitions are an important part of our problem space and should be modeled within our domain.”
The ‘old’ domain model
Domain focused on behavior

More Related Content

Viewers also liked (13)

Social Media are serious or maybe #not
Social Media are serious or maybe #notSocial Media are serious or maybe #not
Social Media are serious or maybe #not
Socialab
Gesture drawing
Gesture drawingGesture drawing
Gesture drawing
Riverwood HS
Repurpose Your Career - 5 Steps to your Next Career Pivot
Repurpose Your Career - 5 Steps to your Next Career PivotRepurpose Your Career - 5 Steps to your Next Career Pivot
Repurpose Your Career - 5 Steps to your Next Career Pivot
Career Pivot
Professor Joanne Goodell presents Performance Based Funding
Professor Joanne Goodell presents Performance Based FundingProfessor Joanne Goodell presents Performance Based Funding
Professor Joanne Goodell presents Performance Based Funding
Australian Centre for Student Equity and Success
Рекоменд. письмо_МинСпорт
Рекоменд. письмо_МинСпортРекоменд. письмо_МинСпорт
Рекоменд. письмо_МинСпорт
Natalia Sidorkina
The Top 10 Mistakes on Local Websites & How to Fix Them
The Top 10 Mistakes on Local Websites & How to Fix ThemThe Top 10 Mistakes on Local Websites & How to Fix Them
The Top 10 Mistakes on Local Websites & How to Fix Them
Greg Gifford
SEO & Social Media Explained
SEO & Social Media ExplainedSEO & Social Media Explained
SEO & Social Media Explained
Trademark Productions, Inc
Olympics team usa bsktball rio 2016 defenders
Olympics team usa bsktball rio 2016 defendersOlympics team usa bsktball rio 2016 defenders
Olympics team usa bsktball rio 2016 defenders
Avi Dey
MLConf - Emmys, Oscars & Machine Learning Algorithms at Netflix
MLConf - Emmys, Oscars & Machine Learning Algorithms at NetflixMLConf - Emmys, Oscars & Machine Learning Algorithms at Netflix
MLConf - Emmys, Oscars & Machine Learning Algorithms at Netflix
Xavier Amatriain
El diarioEl diario
El diario
Banesa Ruiz
Phonetic sounds i
Phonetic sounds iPhonetic sounds i
Phonetic sounds i
Anabel Milagros Montes Miranda
Hướng dẫn chuẩn bị cho kì thi JLPT 2014
Hướng dẫn chuẩn bị cho kì thi JLPT 2014Hướng dẫn chuẩn bị cho kì thi JLPT 2014
Hướng dẫn chuẩn bị cho kì thi JLPT 2014
Mina Japanese Center
Social Media are serious or maybe #not
Social Media are serious or maybe #notSocial Media are serious or maybe #not
Social Media are serious or maybe #not
Socialab
Repurpose Your Career - 5 Steps to your Next Career Pivot
Repurpose Your Career - 5 Steps to your Next Career PivotRepurpose Your Career - 5 Steps to your Next Career Pivot
Repurpose Your Career - 5 Steps to your Next Career Pivot
Career Pivot
Рекоменд. письмо_МинСпорт
Рекоменд. письмо_МинСпортРекоменд. письмо_МинСпорт
Рекоменд. письмо_МинСпорт
Natalia Sidorkina
The Top 10 Mistakes on Local Websites & How to Fix Them
The Top 10 Mistakes on Local Websites & How to Fix ThemThe Top 10 Mistakes on Local Websites & How to Fix Them
The Top 10 Mistakes on Local Websites & How to Fix Them
Greg Gifford
Olympics team usa bsktball rio 2016 defenders
Olympics team usa bsktball rio 2016 defendersOlympics team usa bsktball rio 2016 defenders
Olympics team usa bsktball rio 2016 defenders
Avi Dey
MLConf - Emmys, Oscars & Machine Learning Algorithms at Netflix
MLConf - Emmys, Oscars & Machine Learning Algorithms at NetflixMLConf - Emmys, Oscars & Machine Learning Algorithms at Netflix
MLConf - Emmys, Oscars & Machine Learning Algorithms at Netflix
Xavier Amatriain
El diarioEl diario
El diario
Banesa Ruiz
Hướng dẫn chuẩn bị cho kì thi JLPT 2014
Hướng dẫn chuẩn bị cho kì thi JLPT 2014Hướng dẫn chuẩn bị cho kì thi JLPT 2014
Hướng dẫn chuẩn bị cho kì thi JLPT 2014
Mina Japanese Center

Similar to Introduction to CQRS (20)

CQRS: A More Effective Way of Writing the Same Applications
CQRS: A More Effective Way of Writing the Same ApplicationsCQRS: A More Effective Way of Writing the Same Applications
CQRS: A More Effective Way of Writing the Same Applications
CodeFest
Exploiting the Data / Code Duality with Dali
Exploiting the Data / Code Duality with DaliExploiting the Data / Code Duality with Dali
Exploiting the Data / Code Duality with Dali
Carl Steinbach
La creación de una capa operacional con MongoDB
La creación de una capa operacional con MongoDBLa creación de una capa operacional con MongoDB
La creación de una capa operacional con MongoDB
MongoDB
How to choose the right software
How to choose the right softwareHow to choose the right software
How to choose the right software
Rüdiger Gros
A CQRS Journey
A CQRS JourneyA CQRS Journey
A CQRS Journey
Chrysovalantis Koutsoumpos
Enabling multi tenancy(An Industrial Experience Report)
Enabling multi tenancy(An Industrial Experience Report)Enabling multi tenancy(An Industrial Experience Report)
Enabling multi tenancy(An Industrial Experience Report)
ICSM 2010
Raleigh Kafka Meetup - DDD, ES, and CQRS
Raleigh Kafka Meetup - DDD, ES, and CQRSRaleigh Kafka Meetup - DDD, ES, and CQRS
Raleigh Kafka Meetup - DDD, ES, and CQRS
Jeff Dutton
Architecting for Change: An Agile Approach
Architecting for Change: An Agile ApproachArchitecting for Change: An Agile Approach
Architecting for Change: An Agile Approach
Ben Stopford
M-Files Enterprise Content Management Software
M-Files Enterprise Content Management SoftwareM-Files Enterprise Content Management Software
M-Files Enterprise Content Management Software
Chris Davidson
How to Get Cloud Architecture and Design Right the First Time
How to Get Cloud Architecture and Design Right the First TimeHow to Get Cloud Architecture and Design Right the First Time
How to Get Cloud Architecture and Design Right the First Time
David Linthicum
Greenfield Development with CQRS
Greenfield Development with CQRSGreenfield Development with CQRS
Greenfield Development with CQRS
David Hoerster
Advanced web application architecture - PHP Barcelona
Advanced web application architecture  - PHP BarcelonaAdvanced web application architecture  - PHP Barcelona
Advanced web application architecture - PHP Barcelona
Matthias Noback
Cloud First Architecture
Cloud First ArchitectureCloud First Architecture
Cloud First Architecture
Cameron Vetter
Legacy Migration Overview
Legacy Migration OverviewLegacy Migration Overview
Legacy Migration Overview
Bambordé Baldé
Legacy Migration
Legacy MigrationLegacy Migration
Legacy Migration
WORPCLOUD LTD
Introduction to Puppet Enterprise 10/03/2018
Introduction to Puppet Enterprise 10/03/2018Introduction to Puppet Enterprise 10/03/2018
Introduction to Puppet Enterprise 10/03/2018
Puppet
Everything you want to know about microservices
Everything you want to know about microservicesEverything you want to know about microservices
Everything you want to know about microservices
Youness Lasmak
Crafted Design - Sandro Mancuso
Crafted Design - Sandro MancusoCrafted Design - Sandro Mancuso
Crafted Design - Sandro Mancuso
JAXLondon2014
Cloud Migration headache? Ease the pain with Data Virtualization! (EMEA)
Cloud Migration headache? Ease the pain with Data Virtualization! (EMEA)Cloud Migration headache? Ease the pain with Data Virtualization! (EMEA)
Cloud Migration headache? Ease the pain with Data Virtualization! (EMEA)
Denodo
Multi Tier Architecture
Multi Tier ArchitectureMulti Tier Architecture
Multi Tier Architecture
gatigno
CQRS: A More Effective Way of Writing the Same Applications
CQRS: A More Effective Way of Writing the Same ApplicationsCQRS: A More Effective Way of Writing the Same Applications
CQRS: A More Effective Way of Writing the Same Applications
CodeFest
Exploiting the Data / Code Duality with Dali
Exploiting the Data / Code Duality with DaliExploiting the Data / Code Duality with Dali
Exploiting the Data / Code Duality with Dali
Carl Steinbach
La creación de una capa operacional con MongoDB
La creación de una capa operacional con MongoDBLa creación de una capa operacional con MongoDB
La creación de una capa operacional con MongoDB
MongoDB
How to choose the right software
How to choose the right softwareHow to choose the right software
How to choose the right software
Rüdiger Gros
Enabling multi tenancy(An Industrial Experience Report)
Enabling multi tenancy(An Industrial Experience Report)Enabling multi tenancy(An Industrial Experience Report)
Enabling multi tenancy(An Industrial Experience Report)
ICSM 2010
Raleigh Kafka Meetup - DDD, ES, and CQRS
Raleigh Kafka Meetup - DDD, ES, and CQRSRaleigh Kafka Meetup - DDD, ES, and CQRS
Raleigh Kafka Meetup - DDD, ES, and CQRS
Jeff Dutton
Architecting for Change: An Agile Approach
Architecting for Change: An Agile ApproachArchitecting for Change: An Agile Approach
Architecting for Change: An Agile Approach
Ben Stopford
M-Files Enterprise Content Management Software
M-Files Enterprise Content Management SoftwareM-Files Enterprise Content Management Software
M-Files Enterprise Content Management Software
Chris Davidson
How to Get Cloud Architecture and Design Right the First Time
How to Get Cloud Architecture and Design Right the First TimeHow to Get Cloud Architecture and Design Right the First Time
How to Get Cloud Architecture and Design Right the First Time
David Linthicum
Greenfield Development with CQRS
Greenfield Development with CQRSGreenfield Development with CQRS
Greenfield Development with CQRS
David Hoerster
Advanced web application architecture - PHP Barcelona
Advanced web application architecture  - PHP BarcelonaAdvanced web application architecture  - PHP Barcelona
Advanced web application architecture - PHP Barcelona
Matthias Noback
Introduction to Puppet Enterprise 10/03/2018
Introduction to Puppet Enterprise 10/03/2018Introduction to Puppet Enterprise 10/03/2018
Introduction to Puppet Enterprise 10/03/2018
Puppet
Everything you want to know about microservices
Everything you want to know about microservicesEverything you want to know about microservices
Everything you want to know about microservices
Youness Lasmak
Crafted Design - Sandro Mancuso
Crafted Design - Sandro MancusoCrafted Design - Sandro Mancuso
Crafted Design - Sandro Mancuso
JAXLondon2014
Cloud Migration headache? Ease the pain with Data Virtualization! (EMEA)
Cloud Migration headache? Ease the pain with Data Virtualization! (EMEA)Cloud Migration headache? Ease the pain with Data Virtualization! (EMEA)
Cloud Migration headache? Ease the pain with Data Virtualization! (EMEA)
Denodo
Multi Tier Architecture
Multi Tier ArchitectureMulti Tier Architecture
Multi Tier Architecture
gatigno

More from Pieter Joost van de Sande (13)

Actor Model
Actor ModelActor Model
Actor Model
Pieter Joost van de Sande
Microservices
MicroservicesMicroservices
Microservices
Pieter Joost van de Sande
Microservices
MicroservicesMicroservices
Microservices
Pieter Joost van de Sande
Werckers path to Go
Werckers path to GoWerckers path to Go
Werckers path to Go
Pieter Joost van de Sande
Lessons for developers - long edition
Lessons for developers  - long editionLessons for developers  - long edition
Lessons for developers - long edition
Pieter Joost van de Sande
Lessons for developers
Lessons for developersLessons for developers
Lessons for developers
Pieter Joost van de Sande
Rethink your architecture with CQRS
Rethink your architecture with CQRSRethink your architecture with CQRS
Rethink your architecture with CQRS
Pieter Joost van de Sande
Domain Driven Design fundamentals
Domain Driven Design fundamentalsDomain Driven Design fundamentals
Domain Driven Design fundamentals
Pieter Joost van de Sande
Introduction to Spec#
Introduction to Spec#Introduction to Spec#
Introduction to Spec#
Pieter Joost van de Sande
C#, What Is Next?
C#, What Is Next?C#, What Is Next?
C#, What Is Next?
Pieter Joost van de Sande
Domain Driven Design In C#3.0
Domain Driven Design In C#3.0Domain Driven Design In C#3.0
Domain Driven Design In C#3.0
Pieter Joost van de Sande

Introduction to CQRS