← Graph

Event Sourcing Anti Patterns and Failures

talk 36 connections

Nathan Ladd's wroclove.rb 2018 talk, delivered as the first event-sourcing talk of the conference. Opens with a review of event sourcing: reframing web forms as command messages, comparing a typical MVC+ORM command flow (retrieve model → apply changes → validate → save → cascading callbacks) to the event-sourced flow (project entity → accept/reject → write event). Explains projection as sequentially folding events for a single entity starting from empty state. The bulk of the talk critiques four anti-patterns teams hit when adopting event sourcing, all stemming from continuing to perceive software through an ORM lens: (1) entities coupled to messaging — entities that take command messages as parameters, interpret their attributes, and return events become unusable outside event sourcing and lose cohesion; keep entities as pure core business logic so they could be swapped to an ORM without change; (2) view-biased event schemas — stuffing UI-only fields like a category_id into events to make materialized views easy; events should record only what occurred, and views should be composed from multiple streams with additional aggregation techniques; a variant is reusing a Rails-style errors object, which leaks UI dispositions (negative vs positive) into the domain (an overdraft isn't an 'error' to the bank that charges a fee); (3) opaque dependencies — frameworks that hide the projection by passing an already-projected entity into the handler (beginners can't find the event sourcing, caching/strategy can't be controlled except via global configuration), situations where no entity is needed at all (email uniqueness via a reservation event, updating materialized views, telemetry handlers), and opaque writers where the handler returns events instead of writing them (concurrency countermeasures like 'expected version' cannot be applied per-case, and failures to persist after irreversible external side effects like Stripe charges become very bad); handlers must control their writer just as they should control all dependencies (substitute writers make handler tests never hit the database); (4) the aggregate-root class pattern — mixing entity, handler, and projection responsibilities into one class for convenience, which Ladd has seen cause real damage at multiple clients and which forfeits the big testability wins of event sourcing (isolated entity tests, isolated projection tests, handler tests that assert on what was written). Posits that aggregates are popular because many web developers are uncomfortable with object-oriented structural design and prefer to stuff everything into a subclass of a framework artifact; the 'we'll refactor once we know the boundaries' justification is backwards — coding is not how you learn what the system should be. Closes with warnings about community and thought-leader worship (communities can suppress critical thinking; rails-better-than-rails communities still ship god classes), the reminder that tooling never forced anyone to build a monolith, contextualized complexity (your OS, Ruby VM, and web browser are all very complex but you only deal with a small subset at a time), and 'measure twice, cut once' — spending a week of up-front design on one service is not waterfall, even if the community now finds 6–18 minutes of design uncomfortable. Q&A covers: what an entity is (a data structure with domain-specific methods, sometimes logical like an account microservice); whether the account's sufficient-funds check is a feature-envy smell (the conditional legitimately belongs in the handler because deciding which message to write is a messaging concern); the biggest challenge (you will never prototype as fast as Rails); idempotence and transactional integrity with external systems (the handler is authoritative when it owns the data; external calls belong in the handler and need idempotence patterns); event ordering across distributed systems (use vector clocks, but teach the underlying problem first); whether Rails adopters write handlers instead of controller actions (prefer writing the command to a stream if planning to go micro-services — portable across Rails/Hanami); event versioning (hard — in monoliths you publish new versions and branch on read; in micro-services you can rebuild the whole service and transform old events into new commands; best answer: don't make the mistake, and learn from mistakes instead of switching languages); centralised vs per-service event stores (event stores have no cross-stream associations, so a shared physical store is fine — split only for operational reasons like scale); whether events store current state or just changes (events are raw occurrences; current state is folded from them, cached via per-version cache records, and periodically snapshotted for streams with millions of events); GDPR (regulations are part of the business domain, not the framework).

date
2018-03-16
type
talk
talk Event Sourcing Anti Patterns and Failures
about
Event Sourcing concept
Whole talk is about event sourcing and its anti-patterns.
talk Event Sourcing Anti Patterns and Failures
about
Command Message concept
Opens by reframing web forms and controller inputs as command messages.
talk Event Sourcing Anti Patterns and Failures
about
Command Handler concept
Describes MVC controllers as command handlers and argues handlers must own projection and writing.
talk Event Sourcing Anti Patterns and Failures
about
Explains projection as folding an event stream into an entity, and warns against hiding it.
talk Event Sourcing Anti Patterns and Failures
about
First anti-pattern covered.
talk Event Sourcing Anti Patterns and Failures
about
Second anti-pattern covered.
talk Event Sourcing Anti Patterns and Failures
about
Third anti-pattern, covering opaque projections and opaque writers.
talk Event Sourcing Anti Patterns and Failures
about
Fourth anti-pattern — the 'friendly fight' Ladd picks.
talk Event Sourcing Anti Patterns and Failures
about
Cited as a case where no entity is needed, so framework-forced entities are harmful.
talk Event Sourcing Anti Patterns and Failures
about
Used as the key example of why handlers must control their writers.
talk Event Sourcing Anti Patterns and Failures
about
Closing argument that added patterns are contextualized complexity, not global complexity.
talk Event Sourcing Anti Patterns and Failures
about
Aggregate Root concept
Directly critiques the aggregate-root pattern and its use.
talk Event Sourcing Anti Patterns and Failures
about
Event Store concept
Discusses writing to the event store, its immutability, and centralised-vs-per-service deployment.
talk Event Sourcing Anti Patterns and Failures
about
Sketched as the Eventide library providing entity projection with cache and snapshotting.
talk Event Sourcing Anti Patterns and Failures
about
Active Record concept
Uses MVC+ORM as the foil against which event sourcing is contrasted.
asked_at
Event Sourcing Anti Patterns and Failures talk
Q&A after the talk.
asked_at
Event Sourcing Anti Patterns and Failures talk
Q&A after the talk.
asked_at
Event Sourcing Anti Patterns and Failures talk
Q&A after the talk.
asked_at
Event Sourcing Anti Patterns and Failures talk
Q&A after the talk.
asked_at
Event Sourcing Anti Patterns and Failures talk
Q&A after the talk.
asked_at
Event Sourcing Anti Patterns and Failures talk
Q&A after the talk.
asked_at
Event Sourcing Anti Patterns and Failures talk
Q&A after the talk.
asked_at
Event Sourcing Anti Patterns and Failures talk
Q&A after the talk.
asked_at
Event Sourcing Anti Patterns and Failures talk
Q&A after the talk.
asked_at
Event Sourcing Anti Patterns and Failures talk
Q&A after the talk.
person Nathan Ladd
authored
Event Sourcing Anti Patterns and Failures talk
Nathan Ladd presented the talk as a co-principal of Eventide.
from_talk
Event Sourcing Anti Patterns and Failures talk
Explicit warning motivating avoidance of the anti-patterns.
from_talk
Event Sourcing Anti Patterns and Failures talk
Recommendation from the first anti-pattern.
from_talk
Event Sourcing Anti Patterns and Failures talk
Recommendation from the second anti-pattern.
from_talk
Event Sourcing Anti Patterns and Failures talk
Recommendation from the third anti-pattern.
from_talk
Event Sourcing Anti Patterns and Failures talk
Recommendation from the fourth anti-pattern.
from_talk
Event Sourcing Anti Patterns and Failures talk
Closing meta-advice section of the talk.
from_talk
Event Sourcing Anti Patterns and Failures talk
Closing 'measure twice, cut once' message.
from_talk
Event Sourcing Anti Patterns and Failures talk
Closing warning against blaming Rails or expecting Elixir to fix it.
talk Event Sourcing Anti Patterns and Failures
presented_at
Delivered as the first event-sourcing talk of wroclove.rb 2018.
related_to
Event Sourcing Anti Patterns and Failures talk
Pavel's talk is the 'introduction' companion to Nathan Ladd's anti-patterns talk in the Eventide ecosystem.

Provenance

Created
2026-04-17 16:17 seed
Read by
23 extractions