event sourcing and combating accidental complexity
TRANSCRIPT
![Page 1: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/1.jpg)
hello!
@pieterkoornhof
sneakycode.net
![Page 2: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/2.jpg)
Assume Complex Problems
![Page 3: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/3.jpg)
accidental complexity
![Page 4: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/4.jpg)
3 Choices
![Page 5: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/5.jpg)
#1
![Page 6: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/6.jpg)
sql#1
orm
logic
![Page 7: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/7.jpg)
sql#1
orm
logic
dto+
serviceddd
entities
![Page 8: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/8.jpg)
sql#1
orm
logic
![Page 9: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/9.jpg)
sql#1
orm
logic
views
![Page 10: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/10.jpg)
sql#1
views
![Page 11: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/11.jpg)
sql#1
![Page 12: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/12.jpg)
#1 Confused Models
![Page 13: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/13.jpg)
#2
![Page 14: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/14.jpg)
Full Text
Searching
Related
ItemsData Blobs
Reporting
Fancy Databas
e
#2
![Page 15: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/15.jpg)
Graph
Relational
Fancy Databas
e
#2
Search Index
Document
![Page 16: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/16.jpg)
App
#2
Graph
Relational
Search Index
Document
![Page 17: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/17.jpg)
#2 Wrong Models( Sucky Database )
![Page 18: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/18.jpg)
#3
![Page 19: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/19.jpg)
#3
Cart
Product
Customer
*
![Page 20: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/20.jpg)
Peets Cart
#3
![Page 21: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/21.jpg)
++++
++++ + -
Peets Cart
#3
![Page 22: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/22.jpg)
Cart
Product
Customer
*1. Added Apple
2. Added Apple
3. Added Rocket
4. Added Camera
5. Removed Rocket
6. Added Bike
7. Paid
#3
![Page 23: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/23.jpg)
Cart
Product
Customer
*
Removed
Item*
#3
![Page 24: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/24.jpg)
1. Added Apple
2. Added Apple
3. Added Rocket
4. Added Camera
5. Removed Rocket
6. Added Bike
7. Paid
Cart
Product
Customer
*
Removed
Item
*
#3
![Page 25: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/25.jpg)
#3 Data Loss
![Page 26: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/26.jpg)
#1 Confused Models #2 Wrong Models #3 Data Loss
accidental complexity
![Page 27: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/27.jpg)
data Graph
Relational
Fancy Database
Search
Index
Document
#1 Confused Models #2 Wrong Models #3 Data Loss
1. Added Apple2. Added Apple3. Added Rocket4. Added Camera5. Removed Rocket6. Added Bike7. Paid
CQRS Polyglot Data Event Sourcing
![Page 28: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/28.jpg)
Event Sourcing
![Page 29: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/29.jpg)
event store
Stores EventsremovedFromCart { cartId: 2134-DSF3-SDFW, item : Rocket, quanity: 1}
1. Added Apple
2. Added Apple
3. Added Rocket
4. Added Camera
5. Removed Rocket
6. Added Bike
7. Paid
![Page 30: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/30.jpg)
event store
Append OnlyImmutable
No Updates
No Deletes
![Page 31: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/31.jpg)
I want to Pay
![Page 32: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/32.jpg)
Command
(write)
App
pay { cartId: 2134-DSF3-SDFW, discount: 31%, cardDetails: Visa}
![Page 33: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/33.jpg)
Command
(write)
App
event store f(events) => state
f(state, command) => event(s)
1. Added Apple2. Added Apple3. Added Rocket4. Added Camera5. Removed
Rocket6. Added Bike 7, Paid
Cart
Product
Customer
*
![Page 34: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/34.jpg)
Command
(write) read
App
event store
sql
neo4j
f(events) => viewState
![Page 35: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/35.jpg)
command eventLogic View
![Page 36: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/36.jpg)
command eventLogic View
store
Just Messages
No Data Loss!
![Page 37: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/37.jpg)
command eventLogic View
Things Happend
Replay!
![Page 38: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/38.jpg)
command eventLogic View
Scale!
![Page 39: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/39.jpg)
command eventLogic View
app.Handle( Command )
store.Load<T>( Id )
store.Save( T )
Minimal Boilerplate!
![Page 40: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/40.jpg)
command eventLogic View
input
output
Testing!events, command =>
event(s)
![Page 41: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/41.jpg)
command eventLogic View
jake
sas
Workload!
rob
![Page 42: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/42.jpg)
CharacteristicsMultiple Databases
Operational Complexity
Eventual Consistency
![Page 43: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/43.jpg)
3 Choices
![Page 44: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/44.jpg)
geteventstore.com
![Page 45: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/45.jpg)
github.com/SneakyPeet/EasyEventSourcing
![Page 46: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/46.jpg)
thanx!
@pieterkoornhof
sneakycode.net
![Page 47: Event Sourcing and Combating Accidental Complexity](https://reader035.vdocuments.mx/reader035/viewer/2022062904/5876b5051a28abad1a8b57d9/html5/thumbnails/47.jpg)
CreditsSpecial thanks to all the people who made and released these awesome resources for free:✘ Presentation template by SlidesCarnival✘ Photographs by Unsplash