event sourcing and combating accidental complexity
TRANSCRIPT
hello!
@pieterkoornhof
sneakycode.net
Assume Complex Problems
accidental complexity
3 Choices
#1
sql#1
orm
logic
sql#1
orm
logic
dto+
serviceddd
entities
sql#1
orm
logic
sql#1
orm
logic
views
sql#1
views
sql#1
#1 Confused Models
#2
Full Text
Searching
Related
ItemsData Blobs
Reporting
Fancy Databas
e
#2
Graph
Relational
Fancy Databas
e
#2
Search Index
Document
App
#2
Graph
Relational
Search Index
Document
#2 Wrong Models( Sucky Database )
#3
#3
Cart
Product
Customer
*
Peets Cart
#3
++++
++++ + -
Peets Cart
#3
Cart
Product
Customer
*1. Added Apple
2. Added Apple
3. Added Rocket
4. Added Camera
5. Removed Rocket
6. Added Bike
7. Paid
#3
Cart
Product
Customer
*
Removed
Item*
#3
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
#3 Data Loss
#1 Confused Models #2 Wrong Models #3 Data Loss
accidental complexity
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
Event Sourcing
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
event store
Append OnlyImmutable
No Updates
No Deletes
I want to Pay
Command
(write)
App
pay { cartId: 2134-DSF3-SDFW, discount: 31%, cardDetails: Visa}
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
*
Command
(write) read
App
event store
sql
neo4j
f(events) => viewState
command eventLogic View
command eventLogic View
store
Just Messages
No Data Loss!
command eventLogic View
Things Happend
Replay!
command eventLogic View
Scale!
command eventLogic View
app.Handle( Command )
store.Load<T>( Id )
store.Save( T )
Minimal Boilerplate!
command eventLogic View
input
output
Testing!events, command =>
event(s)
command eventLogic View
jake
sas
Workload!
rob
CharacteristicsMultiple Databases
Operational Complexity
Eventual Consistency
3 Choices
geteventstore.com
github.com/SneakyPeet/EasyEventSourcing
thanx!
@pieterkoornhof
sneakycode.net
CreditsSpecial thanks to all the people who made and released these awesome resources for free:✘ Presentation template by SlidesCarnival✘ Photographs by Unsplash