- Storing only "current state" completely loses all business value of "how things got this way over time" (time traveling lost)
- Think about showing how event-sourced projections do the same level of work that is traditionally done by complicated SQL queries and graph building from disparate data sources -- but when combined with read-models they do them ahead of query time so as to optimize the retrieval of such data when it's used.
- Different thinking
- Requires training
- Immutability forces complication here
- Greg Young wrote "Versioning in an Event Sourced System" boook on the subject
- Introduces "moving parts" -- covered in CQRS chapter
Beware of these when deciding whether or not to use an event-sourced domain model. Simpler, "current state" based approaches may be sufficient in many scenarios. Chapter 10 gives rules of thumb.
- Make sure to benchmark actual vs feared impact
- Consider aggregate lifespan and number of events within this window
- Fewer than 10k events is usually not a problem
- Snapshot pattern can be introduced to mitigate
- Cached representations of the aggregate's current state up to recent time period.
- Note that this is how EventStoreDB works with projections (TODO: Link to CommitStream examples)
- Easy to shard all events for aggregates to specific nodes / stores
- Apply forgettable payload pattern
- Encrypt sensitive data with customer-specific key
- Delete key when customer requests or other occurence dictates
- Error prone
- Two-stage transaction, subject to rollback, partial failure
- Prone to engineer forgetting to apply consistency
- Log table schema usually degrades into chaos
- Only includes dry facts
- No capture of business intent or user intent at all
- No ability for really projecting alternate reports of read models via "time travel"
- Event-sourced domain model adds dimension of Time
- All aggregate changes expressed as domain events
- As opposed to simply changing a database row or document's "currentn state"
- This gives ability to "time travel" for alternate reports and read models
- Gives deep insight ability
- A
- C
- B -- B & C
- A