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
Event Sourcing RubySPBConf 2k18
Search
Anton Davydov
June 10, 2018
Programming
1
180
Event Sourcing RubySPBConf 2k18
Anton Davydov
June 10, 2018
Tweet
Share
More Decks by Anton Davydov
See All by Anton Davydov
How to make a technical decision
davydovanton
0
92
МГТУ
davydovanton
0
61
Events. Events. Events! - krk.rb
davydovanton
0
140
Events. Events. Events!
davydovanton
0
760
Architecture of hanami applications
davydovanton
1
7.5k
Hanami Architecture
davydovanton
2
260
viewing ruby blossom kaigi2017
davydovanton
0
580
viewing ruby blossom rdrc2017
davydovanton
2
200
rodauth device and you
davydovanton
2
220
Other Decks in Programming
See All in Programming
Building Scalable Mobile Projects: Fast Builds, High Reusability and Clear Ownership
cyrilmottier
2
260
SwiftUI API Design Lessons
niw
1
260
Boost Your Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
1.2k
AWSで雰囲気でつくる! VRChatの写真変換ピタゴラスイッチ
anatofuz
0
140
AIコーディングワークフローの試行 〜AIエージェント×ワークフローでの自動化を目指して〜
rkaga
2
3.4k
自分のために作ったアプリが、グローバルに使われるまで / Indie App Development Lunch LT
pixyzehn
1
150
パスキーのすべて / 20250324 iddance Lesson.5
kuralab
0
150
Django for Data Science (Boston Python Meetup, March 2025)
wsvincent
0
320
PHPバージョンアップから始めるOSSコントリビュート / how2oss-contribute
dmnlk
1
990
MCP世界への招待: AIエンジニアが創る次世代エージェント連携の世界
gunta
4
880
Defying Front-End Inertia: Inertia.js on Rails
skryukov
0
460
MCP調べてみました! / Exploring MCP
uhzz
2
2.2k
Featured
See All Featured
Unsuck your backbone
ammeep
670
57k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Practical Orchestrator
shlominoach
186
10k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
30
2k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
12k
Become a Pro
speakerdeck
PRO
27
5.3k
Typedesign – Prime Four
hannesfritz
41
2.6k
BBQ
matthewcrist
88
9.6k
Code Review Best Practice
trishagee
67
18k
Transcript
->
[email protected]
title: SPBRuby2k18
None
None
None
None
@palkan_tula
me
What I learned in Japan?
Ruby is still dying language
None
Java is popular
None
Pascal is popular too
None
Best shell ever
None
❤ Руддщ ЫЗИ! ❤
❤ Hello SPB! ❤
None
None
None
Anton Davydov github.com/davydovanton twitter.com/anton_davydov davydovanton.com
• Software developer at Hippo • Hanami core developer •
OpenSource evangelist
None
Stickers
None
Part 1: Real World
DEMO
Part 2: Software
None
None
None
None
None
Pros • easy for understand • easy for implement
Cons • we have only current state of the system
• impossible to understand what happened before
Sometimes we need more work for one event
Imagine what will happen if we will work only with
events?
None
None
None
None
None
Congrats, you know event sourcing!
Part 3: Event Sourcing
– Event Sourcing pattern https://docs.microsoft.com/en-us/azure/architecture/patterns/event-sourcing “Instead of storing just the
current state of the data in a domain, use an append-only store to record the full series of actions taken on that data”
How to get business events?
Event Storming
DDD
Part 4: Event Store
None
None
Can be anything
None
Rules
Immutable events
Immutable everything
How to store events?
None
None
None
None
None
How get current state?
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
How we can improve it?
None
None
None
None
None
None
None
Part 5: Conclusions
Event Sourcing pros
Easier to communicate with domain experts
• time traveling • restore a system • logging out
from box
• You don’t work with tables you work with events
• Experemental data structures • Easy to change database implementations
• Easy to add instances for service • Can be
written on any language and you can call it from any app • Persistance
event sourcing cons
• Hard for understand and complicated abstraction • Not popular
in ruby and bad tooling here • Developers need deprogramming
• Hard to get state • Hard to understand the
whole chain of events • Another architecture type with different DB structure
• Async world • Versions and versions compatibility • Updating
or deleting events • Eventual Consistency
Part 6: Usage
Simple way
gems
None
github.com/zilverline/sequent
Brave way
Build all stuff by self
None
None
None
hanami-events
Just pub sub transport layer with event versions and types
microservices
microservices
None
How to share state across DBs?
Idea #1: send data to specific service
None
Problems
One service know about data from other
1 -> N
None
None
Idea #2: events
None
None
None
Important
Make events full as you can
None
None
None
Part 7: Next Steps
CQRS (Command Query Responsibility Segregation)
– Martin Fowler “You can use a different model to
update information than the model you use to read information”
None
None
None
None
None
None
DDD
None
None
None
Books
None
->
[email protected]
title: SPBRuby2k18
github.com/davydovanton twitter.com/anton_davydov davydovanton.com Thank you ❤