Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Introduction to Event Sourcing and CQRS
Search
Guilherme Augusto Henschel
February 17, 2018
Programming
0
500
Introduction to Event Sourcing and CQRS
An Introduction to Event Sourcing and CQRS presented at 11º PHPSC InCompany Meetup
Guilherme Augusto Henschel
February 17, 2018
Tweet
Share
Other Decks in Programming
See All in Programming
フロントエンド開発の勘所 -複数事業を経験して見えた判断軸の違い-
heimusu
6
1.8k
Patterns of Patterns
denyspoltorak
0
420
Go コードベースの構成と AI コンテキスト定義
andpad
0
160
メルカリのリーダビリティチームが取り組む、AI時代のスケーラブルな品質文化
cloverrose
2
450
Combinatorial Interview Problems with Backtracking Solutions - From Imperative Procedural Programming to Declarative Functional Programming - Part 2
philipschwarz
PRO
0
130
疑似コードによるプロンプト記述、どのくらい正確に実行される?
kokuyouwind
0
110
CSC307 Lecture 02
javiergs
PRO
1
760
ZJIT: The Ruby 4 JIT Compiler / Ruby Release 30th Anniversary Party
k0kubun
1
310
クラウドに依存しないS3を使った開発術
simesaba80
0
220
從冷知識到漏洞,你不懂的 Web,駭客懂 - Huli @ WebConf Taiwan 2025
aszx87410
2
3.3k
Vibe codingでおすすめの言語と開発手法
uyuki234
0
160
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
360
Featured
See All Featured
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Music & Morning Musume
bryan
46
7k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
1
340
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
0
410
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
110
ラッコキーワード サービス紹介資料
rakko
0
1.9M
Marketing to machines
jonoalderson
1
4.5k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
9
1k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
110
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.5k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
58
41k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
48
Transcript
11º PHPSC InCompany
Guilherme Augusto Henschel a.k.a. Cenoura developer since 2009 working @
Nexaas
Notice ✘ this talk intent is to open your mind
✘ use these patterns carefully ✘ remember, there is no silver bullet
ORM Customer Memory Database Customer Account owns name address account
Account accountNumber type balance
Event Sourcing
“ Event Sourcing ensures that all changes to application state
are stored as a sequence of events. — Martin Fowler
AccountCreated id: 123 owner: Guilherme H. 1 DepositPerformed accountId: 123
amount: $50 2 WithdrawalPerformed accountId: 123 amount: $20 3
Pros ✘ complete log of every state change ✘ easy
way to undo things ✘ testing, traceability and debugability ✘ business and data analysis of event streams ✘ immutability
Cons ✘ complexity ✘ time to get used to ✘
limited support from frameworks
When ✘ rich object-oriented domain models ✘ critical accountability and
debugability ✘ version control for data ✘ data can give you competitive advantage ✘ building scaleable systems based on CQRS pattern
CQS Command Query Segregation
“ every method should either be a command that performs
an action, or a query that returns data to the caller, but not both. — Bertrand Meyer
CQRS Command Query Responsibility Segregation
“ creating two objects where there was previously only one
Before
Improving
After
Pros ✘ scalability ✘ flexibility ✘ reduced complexity ✘ concentrate
on domain/business
Cons ✘ complexity
When ✘ task based user interfaces ✘ complex data processing
✘ disparity in reads and writes
Event Sourcing + CQRS
None
Libs/Components ✘Broadway - https://github.com/broadway/ broadway ✘Prooph - http://getprooph.org/
thanks! guilhermeaugusto.com.br
References ✘ Greg Young talk - https://www.youtube.com/watch?v=JHGkaShoyNs and https://cqrs.files.wordpress.com/2010/11/cqrs_documents.pdf ✘
Johannes Seitz talk - https://ookami86.github.io/event-sourcing-in- practice/ ✘ Martin Fowler articles - https://martinfowler.com/eaaDev/ EventSourcing.html and https://martinfowler.com/bliki/CQRS.html ✘ Marco Pivetta talk - https://www.youtube.com/watch?v=8NuHNtwjync ✘ http://www.cqrs.nu/ ✘ https://speakerdeck.com/owolf/cqrs-for-great-good ✘ https://speakerdeck.com/mattketmo/cqrs-and-event-sourcing