SlideShare ist ein Scribd-Unternehmen logo
1 von 73
Downloaden Sie, um offline zu lesen
*
CQRS
and friends
me
@luke_randall
github.com/
“A bad design with
“
a test suite is still
a bad design

Rich Hickey
design
patterns
hy
W

design
patterns ?
patterns
vocabulary
shared
understanding
hardest

of being a dev

?
tools
for managing
complexity
value
value
immutable dat
identity
identity
values over time
state
state
snapshot in time
identity ≠ state
objects

conflate
!

identity & state
CQRS
command
command
query
command
query
responsibility
command
query
responsibility
segregation
cf.
command
query
separation
command
≠
query
vs. crud
query (read) side

simple
immutable
objects
command (write) side

simpler
domain
objects
command (write) side

tighter
domain objects
command (write) side

richer
domain
CQRS

benefits
CAP

CA vs AP
event sourcing
event sourcing
is not CQRS
identity
value & state
state
=
snapshot in time
=
sum of events
!
event sourcing
store
all the events
DDD
Add
A
to cart

Add
B
to cart

Remove
B
from cart

Add
C
to cart

Capture
order
address
Consumer
projects events
into data
Add
A
to cart
A

Add
B
to cart

Remove
B
from cart

Add
C
to cart

Capture
order
address
Add
A
to cart

Add
B
to cart
A
B

Remove
B
from cart

Add
C
to cart

Capture
order
address
Add
A
to cart

Add
B
to cart

Remove
B
from cart
A

Add
C
to cart

Capture
order
address
Add
A
to cart

Add
B
to cart

Remove
B
from cart

Add
C
to cart
A
C

Capture
order
address
Add
A
to cart

Add
B
to cart

Remove
B
from cart

Add
C
to cart

Capture
order
address
A
C
idea

project data
form(s) matching
requirements
project data
items removed
at checkout
project data
added then
removed often
project data
age of cart items
project data
other examples
less complexity

simpler models
flexibility

many simpler
schemas
scalability

append only
scalability

append only
flexibility

no migrating
schemas
millions of events

snapshots
commands

vs

events
testing commands

play event log
testing commands

can never be in an
invalid state
testing commands

expectations in
terms of events
given

a list of events
when

I run a command
expect

an event
understandable tests

for nondevelopers
eventual consistency

must be dealt with
benefits
benefits

of a complete history
benefits

of a complete history
of everything
benefits

of a complete history
of everything

ever
disadvantages/gotchas

consistency
mental model
don’t use it for
cruddy apps
simple stuff
your entire app
DDD

bounded contexts
do consider it
where it fits
“
“

Seek simplicity,
and distrust it.
Alfred North Whitehead

Weitere ähnliche Inhalte

Andere mochten auch

What causes Diarrhea IEHA 2008
What causes Diarrhea IEHA 2008What causes Diarrhea IEHA 2008
What causes Diarrhea IEHA 2008Steve Lipton
 
Best practices for_scaling_java_applications_with_distributed_caching
Best practices for_scaling_java_applications_with_distributed_cachingBest practices for_scaling_java_applications_with_distributed_caching
Best practices for_scaling_java_applications_with_distributed_cachingyamingd
 
Learning Pool's Sam Barbee on 'E-learning to train social workers'
Learning Pool's Sam Barbee on 'E-learning to train social workers'Learning Pool's Sam Barbee on 'E-learning to train social workers'
Learning Pool's Sam Barbee on 'E-learning to train social workers'Paul McElvaney
 
Communication
CommunicationCommunication
Communicationyamingd
 
Javaday 2010: Facebook Java Framework
Javaday 2010: Facebook Java FrameworkJavaday 2010: Facebook Java Framework
Javaday 2010: Facebook Java FrameworkMatteo Baccan
 
Reviewing Screen-Based Content
Reviewing Screen-Based ContentReviewing Screen-Based Content
Reviewing Screen-Based ContentRhonda Bracey
 
Mobile Learning And Pd As
Mobile Learning And Pd AsMobile Learning And Pd As
Mobile Learning And Pd Asszurlnick
 
Lezing mainpress webversie
Lezing mainpress webversieLezing mainpress webversie
Lezing mainpress webversieSjef Kerkhofs
 
NEHA AEC 2008 Small Wares: How to Tell A Story
NEHA AEC 2008 Small Wares: How to Tell A StoryNEHA AEC 2008 Small Wares: How to Tell A Story
NEHA AEC 2008 Small Wares: How to Tell A StorySteve Lipton
 
小企业金融业务品牌推广方案 Push(v4.0)
小企业金融业务品牌推广方案 Push(v4.0)小企业金融业务品牌推广方案 Push(v4.0)
小企业金融业务品牌推广方案 Push(v4.0)Push ,Beijing
 
香港六合彩
香港六合彩香港六合彩
香港六合彩wejia
 

Andere mochten auch (17)

Editing
EditingEditing
Editing
 
What causes Diarrhea IEHA 2008
What causes Diarrhea IEHA 2008What causes Diarrhea IEHA 2008
What causes Diarrhea IEHA 2008
 
Best practices for_scaling_java_applications_with_distributed_caching
Best practices for_scaling_java_applications_with_distributed_cachingBest practices for_scaling_java_applications_with_distributed_caching
Best practices for_scaling_java_applications_with_distributed_caching
 
Learning Pool's Sam Barbee on 'E-learning to train social workers'
Learning Pool's Sam Barbee on 'E-learning to train social workers'Learning Pool's Sam Barbee on 'E-learning to train social workers'
Learning Pool's Sam Barbee on 'E-learning to train social workers'
 
Lecture 10
Lecture 10Lecture 10
Lecture 10
 
Communication
CommunicationCommunication
Communication
 
Javaday 2010: Facebook Java Framework
Javaday 2010: Facebook Java FrameworkJavaday 2010: Facebook Java Framework
Javaday 2010: Facebook Java Framework
 
Reviewing Screen-Based Content
Reviewing Screen-Based ContentReviewing Screen-Based Content
Reviewing Screen-Based Content
 
Social mediacongres
Social mediacongresSocial mediacongres
Social mediacongres
 
Mobile Learning And Pd As
Mobile Learning And Pd AsMobile Learning And Pd As
Mobile Learning And Pd As
 
相爱如此美丽
相爱如此美丽相爱如此美丽
相爱如此美丽
 
Lezing mainpress webversie
Lezing mainpress webversieLezing mainpress webversie
Lezing mainpress webversie
 
06.10.07 Children
06.10.07   Children06.10.07   Children
06.10.07 Children
 
NEHA AEC 2008 Small Wares: How to Tell A Story
NEHA AEC 2008 Small Wares: How to Tell A StoryNEHA AEC 2008 Small Wares: How to Tell A Story
NEHA AEC 2008 Small Wares: How to Tell A Story
 
小企业金融业务品牌推广方案 Push(v4.0)
小企业金融业务品牌推广方案 Push(v4.0)小企业金融业务品牌推广方案 Push(v4.0)
小企业金融业务品牌推广方案 Push(v4.0)
 
香港六合彩
香港六合彩香港六合彩
香港六合彩
 
Chritmas
ChritmasChritmas
Chritmas
 

Ähnlich wie CQRS

Beer&Tech: Tech Documentation - cod == doc
Beer&Tech: Tech Documentation - cod == docBeer&Tech: Tech Documentation - cod == doc
Beer&Tech: Tech Documentation - cod == docGilles Legoux
 
Event Sourcing & CQRS: Down the rabbit hole
Event Sourcing & CQRS: Down the rabbit holeEvent Sourcing & CQRS: Down the rabbit hole
Event Sourcing & CQRS: Down the rabbit holeJulian May
 
Patterns and Practices for Event Design With Adam Bellemare | Current 2022
Patterns and Practices for Event Design With Adam Bellemare | Current 2022Patterns and Practices for Event Design With Adam Bellemare | Current 2022
Patterns and Practices for Event Design With Adam Bellemare | Current 2022HostedbyConfluent
 
Event Sourcing, Stream Processing and Serverless (Benjamin Stopford, Confluen...
Event Sourcing, Stream Processing and Serverless (Benjamin Stopford, Confluen...Event Sourcing, Stream Processing and Serverless (Benjamin Stopford, Confluen...
Event Sourcing, Stream Processing and Serverless (Benjamin Stopford, Confluen...confluent
 
Developing functional domain models with event sourcing (oakjug, sfscala)
Developing functional domain models with event sourcing (oakjug, sfscala)Developing functional domain models with event sourcing (oakjug, sfscala)
Developing functional domain models with event sourcing (oakjug, sfscala)Chris Richardson
 
Event Sourcing, Stream Processing and Serverless (Ben Stopford, Confluent) K...
Event Sourcing, Stream Processing and Serverless (Ben Stopford, Confluent)  K...Event Sourcing, Stream Processing and Serverless (Ben Stopford, Confluent)  K...
Event Sourcing, Stream Processing and Serverless (Ben Stopford, Confluent) K...confluent
 
Agile drupal tips - leverage JIRA for good
Agile drupal tips - leverage JIRA for goodAgile drupal tips - leverage JIRA for good
Agile drupal tips - leverage JIRA for goodChris Urban
 
You Put *What* in Your Stream?! Patterns and Practices for Event Design with ...
You Put *What* in Your Stream?! Patterns and Practices for Event Design with ...You Put *What* in Your Stream?! Patterns and Practices for Event Design with ...
You Put *What* in Your Stream?! Patterns and Practices for Event Design with ...HostedbyConfluent
 
DDD meets CQRS and event sourcing
DDD meets CQRS and event sourcingDDD meets CQRS and event sourcing
DDD meets CQRS and event sourcingGottfried Szing
 
Embrace NoSQL and Eventual Consistency with Ripple
Embrace NoSQL and Eventual Consistency with RippleEmbrace NoSQL and Eventual Consistency with Ripple
Embrace NoSQL and Eventual Consistency with RippleSean Cribbs
 
Cqrs and event sourcing in azure
Cqrs and event sourcing in azureCqrs and event sourcing in azure
Cqrs and event sourcing in azureSergey Seletsky
 
Data Visualization Strategies & Open Source Tools
Data Visualization Strategies & Open Source ToolsData Visualization Strategies & Open Source Tools
Data Visualization Strategies & Open Source ToolsPhase2
 

Ähnlich wie CQRS (12)

Beer&Tech: Tech Documentation - cod == doc
Beer&Tech: Tech Documentation - cod == docBeer&Tech: Tech Documentation - cod == doc
Beer&Tech: Tech Documentation - cod == doc
 
Event Sourcing & CQRS: Down the rabbit hole
Event Sourcing & CQRS: Down the rabbit holeEvent Sourcing & CQRS: Down the rabbit hole
Event Sourcing & CQRS: Down the rabbit hole
 
Patterns and Practices for Event Design With Adam Bellemare | Current 2022
Patterns and Practices for Event Design With Adam Bellemare | Current 2022Patterns and Practices for Event Design With Adam Bellemare | Current 2022
Patterns and Practices for Event Design With Adam Bellemare | Current 2022
 
Event Sourcing, Stream Processing and Serverless (Benjamin Stopford, Confluen...
Event Sourcing, Stream Processing and Serverless (Benjamin Stopford, Confluen...Event Sourcing, Stream Processing and Serverless (Benjamin Stopford, Confluen...
Event Sourcing, Stream Processing and Serverless (Benjamin Stopford, Confluen...
 
Developing functional domain models with event sourcing (oakjug, sfscala)
Developing functional domain models with event sourcing (oakjug, sfscala)Developing functional domain models with event sourcing (oakjug, sfscala)
Developing functional domain models with event sourcing (oakjug, sfscala)
 
Event Sourcing, Stream Processing and Serverless (Ben Stopford, Confluent) K...
Event Sourcing, Stream Processing and Serverless (Ben Stopford, Confluent)  K...Event Sourcing, Stream Processing and Serverless (Ben Stopford, Confluent)  K...
Event Sourcing, Stream Processing and Serverless (Ben Stopford, Confluent) K...
 
Agile drupal tips - leverage JIRA for good
Agile drupal tips - leverage JIRA for goodAgile drupal tips - leverage JIRA for good
Agile drupal tips - leverage JIRA for good
 
You Put *What* in Your Stream?! Patterns and Practices for Event Design with ...
You Put *What* in Your Stream?! Patterns and Practices for Event Design with ...You Put *What* in Your Stream?! Patterns and Practices for Event Design with ...
You Put *What* in Your Stream?! Patterns and Practices for Event Design with ...
 
DDD meets CQRS and event sourcing
DDD meets CQRS and event sourcingDDD meets CQRS and event sourcing
DDD meets CQRS and event sourcing
 
Embrace NoSQL and Eventual Consistency with Ripple
Embrace NoSQL and Eventual Consistency with RippleEmbrace NoSQL and Eventual Consistency with Ripple
Embrace NoSQL and Eventual Consistency with Ripple
 
Cqrs and event sourcing in azure
Cqrs and event sourcing in azureCqrs and event sourcing in azure
Cqrs and event sourcing in azure
 
Data Visualization Strategies & Open Source Tools
Data Visualization Strategies & Open Source ToolsData Visualization Strategies & Open Source Tools
Data Visualization Strategies & Open Source Tools
 

Kürzlich hochgeladen

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 

Kürzlich hochgeladen (20)

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 

CQRS