Still storing just the current state Database structure is often normalized and optimized for updating Most application read far more frequently then update
A command to update/create a draft permit
Using Flux Standard Actions
We are still storing only the current state No trace of how we got there
Event Sourcing is a very old idea that has become popular again over recent years. Invented by Greg Young Events provide insight into how the system came to be in its current state The current state is a left fold of the events
Invented by Greg Young No longer storing the current state but all event leading up to it The current state is a left fold of all events The projection parts are not really part of ES but CQRS and usually combined
Another service subscribes to the same events And pushes them to each connected client
Events are never erased or updated An append only model
Flux has a very similar and explicit way of working with data.
A Redux reducer function for a collection of permits. It calls another reducer for individual permits Very functional: Old State + Action = New State
A Redux reducer function for a single permit.
The Redux createStore() function creates the store based on the reduce functions. The React-Redux Provider connects the store state to the root App component.
The React-Redux connect functions makes data from the store available as props for the child React component.
More info: Greg Young: http://goodenoughsoftware.net/ Martin Fowler: http://martinfowler.com/eaaDev/EventSourcing.html Daniel Whittaker: http://danielwhittaker.me/tag/event-sourcing/ João Bragança: https://github.com/thefringeninja/derp.inventory Damian Hickey: http://dhickey.ie/?tag=/Event-Sourcing
Maurice de Beijer - @mauricedb
ROME 24-25 MARCH 2017
Who am I?
• Maurice de Beijer
• The Problem Solver
• Microsoft Azure MVP
• Freelance developer/instructor
• Twitter: @mauricedb and @React_Tutorial
• Web: http://www.TheProblemSolver.nl
• E-mail: email@example.com
(Semi) Structured storage
Database CRUD Server HTTP Browser