Event Sourcing
-
Upload
herman-peeren -
Category
Software
-
view
338 -
download
2
description
Transcript of Event Sourcing
Herman Peeren010PHP
November 2014
Event Sourcing
Update
Update
Entities - Relationships
DDD-jargon: Aggregate
Aggregate: house of cooperating entities (consistency boundaries)
DDD-jargon: Aggregate Root
Aggregate root: the entrance of the house, the interface to the outside world
DDD-jargon: Aggregate Root
Aggregate protects its own invariants: keep your house clean
Demeter’s Lawonly talk to your immediate friends
Demeter’s LawCommand the dog, not the dog’s legs
Demeter’s LawCommand the dog, not the dog’s legs
Event Sourcing• you don’t store the state, • but the proces that caused the change
Accounting: same principle• you don’t store the changed balance, • but the journal entries that caused the change
Event Sourcing• you don’t add an item to a collection of jobs, • but you take or quit a job
Event Sourcing• you don’t add an item to a collection of jobs, • but you hire or fire someone
Emphasis on the action, using words used in the domain, not on the data
Event Store
Event Store
Event Sourcing
EntityEquality is decided by its identity, not by its values
never too old to run
Theseus’ship paradox
Theseus’ship paradox
Theseus’ship paradox
Identity
Identity
Identity
IdentityYou are who you were + the difference since then
Functional ProgrammingData are what they were + the difference since then
Event Sourcing & CQRSCQRS = Command Query Responsibility Segregation: separate Read & Write Model
Event Sourcing & CQRS
FromtheAxonFrameworkdocumentation
Event Sourcing & CQRS
Event Sourcing+• lossles, extra read-models can always later be added• more verbs than data centric, closer to mental model and domain language
-• increased complexity when state is rarely updated
CQRS+• loosely coupled, specialised read & write side• scalability
-• more complexity when project is not complex or doesn’t need scaling
Broadway
Broadway: namespaces
Broadway: examples
Other interesting PHP framework (less production-ready?): https://github.com/szjani/predaddy
Pool RequestJoomlaWorldConference,Mexiconovember2014
Thank you!
hermanpeeren.nl@HermanPeeren
November 13, 2014
Credits:Sorry! For this presentation I’ve used all kinds of images I collected from the web during the past months. I didn’t note down the various sources, so I cannot give credit to the owners of the images. I can only thank you all very much for making them available on the internet and I hope I did not violate your rights too much borrowing them. If you own the rights to an image used here, please let me know and I will mention it (or take the image out of these slides if you want to).