Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
CQRS and friends *
Slide 2
Slide 2 text
me @luke_randall github.com/
Slide 3
Slide 3 text
A bad design with a test suite is still a bad design Rich Hickey “ “
Slide 4
Slide 4 text
design patterns
Slide 5
Slide 5 text
design patterns Why ?
Slide 6
Slide 6 text
patterns
Slide 7
Slide 7 text
vocabulary
Slide 8
Slide 8 text
shared understanding
Slide 9
Slide 9 text
of being a dev hardest ? ?
Slide 10
Slide 10 text
for managing complexity tools
Slide 11
Slide 11 text
value
Slide 12
Slide 12 text
value immutable dat
Slide 13
Slide 13 text
identity
Slide 14
Slide 14 text
identity values over time
Slide 15
Slide 15 text
state
Slide 16
Slide 16 text
state snapshot in time
Slide 17
Slide 17 text
identity ≠ state
Slide 18
Slide 18 text
objects ! identity & state conflate
Slide 19
Slide 19 text
CQRS
Slide 20
Slide 20 text
command
Slide 21
Slide 21 text
command query
Slide 22
Slide 22 text
command query responsibility
Slide 23
Slide 23 text
command query responsibility segregation
Slide 24
Slide 24 text
cf. command query separation
Slide 25
Slide 25 text
command ≠ query
Slide 26
Slide 26 text
vs. crud
Slide 27
Slide 27 text
simple immutable objects query (read) side
Slide 28
Slide 28 text
simpler domain objects command (write) side
Slide 29
Slide 29 text
tighter domain objects command (write) side
Slide 30
Slide 30 text
richer domain command (write) side
Slide 31
Slide 31 text
benefits CQRS
Slide 32
Slide 32 text
CA vs AP CAP
Slide 33
Slide 33 text
event sourcing
Slide 34
Slide 34 text
event sourcing is not CQRS
Slide 35
Slide 35 text
identity value & state
Slide 36
Slide 36 text
state = ! = sum of events snapshot in time
Slide 37
Slide 37 text
event sourcing
Slide 38
Slide 38 text
store the events all
Slide 39
Slide 39 text
DDD
Slide 40
Slide 40 text
Add B to cart Add A to cart Remove B from cart Add C to cart Capture order address
Slide 41
Slide 41 text
Consumer projects events into data
Slide 42
Slide 42 text
Add B to cart Add A to cart Remove B from cart Add C to cart Capture order address A
Slide 43
Slide 43 text
Add B to cart Add A to cart Remove B from cart Add C to cart Capture order address A B
Slide 44
Slide 44 text
Add B to cart Add A to cart Remove B from cart Add C to cart Capture order address A
Slide 45
Slide 45 text
Add B to cart Add A to cart Remove B from cart Add C to cart Capture order address A C
Slide 46
Slide 46 text
Add B to cart Add A to cart Remove B from cart Add C to cart Capture order address A C
Slide 47
Slide 47 text
form(s) matching requirements idea project data
Slide 48
Slide 48 text
items removed at checkout project data
Slide 49
Slide 49 text
added then removed often project data
Slide 50
Slide 50 text
age of cart items project data
Slide 51
Slide 51 text
other examples project data
Slide 52
Slide 52 text
less complexity simpler models
Slide 53
Slide 53 text
flexibility many simpler schemas
Slide 54
Slide 54 text
scalability append only
Slide 55
Slide 55 text
scalability append only
Slide 56
Slide 56 text
flexibility no migrating schemas
Slide 57
Slide 57 text
millions of events snapshots
Slide 58
Slide 58 text
vs events commands
Slide 59
Slide 59 text
testing commands play event log
Slide 60
Slide 60 text
testing commands can never be in an invalid state
Slide 61
Slide 61 text
testing commands expectations in terms of events
Slide 62
Slide 62 text
given a list of events when I run a command expect an event
Slide 63
Slide 63 text
understandable tests for non- developers
Slide 64
Slide 64 text
eventual consistency must be dealt with
Slide 65
Slide 65 text
benefits
Slide 66
Slide 66 text
benefits of a complete history
Slide 67
Slide 67 text
benefits of a complete history of everything
Slide 68
Slide 68 text
benefits of a complete history of everything ever
Slide 69
Slide 69 text
disadvantages/gotchas consistency mental model
Slide 70
Slide 70 text
cruddy apps simple stuff your entire app don’t use it for
Slide 71
Slide 71 text
bounded contexts DDD
Slide 72
Slide 72 text
where it fits do consider it
Slide 73
Slide 73 text
Seek simplicity, and distrust it. Alfred North Whitehead “ “