Skip to content

Instantly share code, notes, and snippets.

@archie
Last active May 20, 2019 07:36
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save archie/10103185 to your computer and use it in GitHub Desktop.
Save archie/10103185 to your computer and use it in GitHub Desktop.
Draft blog post about ddd, cqrs, and es.

DDD, CQRS and Event Sourcing

In preparation for a new gig I'm reading up on the terms Domain-Driven Design, Command-Query Responsibility Segregation, and Event Sourcing. Here are a list of useful texts and talks that I've discovered so far. If anything is missing please leave a comment.

DDD

CQRS

  • Command-Query Separation - although first defined in a book by Bertrand Meyer, Fowler makes a great job explaining CQS, the predecessor (sort of) to CQRS.
  • Command-Query Responsibility Segregation - the term is coined by Greg Young (more links below), but again described well by Fowler. Builds on CQS. "At its heart is a simple notion that you can use a different model to update information than the model you use to read information." Moreover, "CQRS allows you to separate the load from reads and writes allowing you to scale each independently" is something I have studied previously, but don't remember using this term for it before. Neat! 1
  • Udi Dahan: Clarified CQRS - Command-Query Responsibility Segregation "explained". Two significant components Dahan addresses that others have left out are collaboration and staleness. 2
  • Greg Young's summary on CQRS - The "invetor's" own summary of the CQRS pattern. Perhaps the most straightforward explanation I've seen so far, but flies over some important aspects of what the pattern means for the data model in my opinion.
  • CQRS pattern explained by MSDN - Good and detailed description of the pattern. Also includes a helpful section on when not to use it (and it has pictures).

Event Sourcing

  • Fowler on Event Sourcing - The gist in one line: "Capture all changes to an application state as a sequence of events." Two notions I find particularly interesting are Temporal Query and Event replay. The post also includes a good list on some challenges with Event Sourcing.
  • Event Sourcing explained by MSDN - The section on Performance, scalability and consistency is useful.
  • EventStore - the basics of storing events rather than objects. "[...] data is not persisted in a structure but as a series of transactions."
  • A deep look into the Event Store - talk by Greg Young from the Oredev conference, Nov 8, 2012.

Additional notes

  • "Focus relentlessly on the core domain" - Evans
  • "CQRS is not a top-level architecture. CQRS is something that happens at a much lower level, where your top level architecture is probably going to look more like SOA and EDA." - Young
  • Aggregates are composed of smaller events. E.g., a purchase order contains line items
  • I'd read Werner Vogel's eventually consistent post before, but stumbled upon it again and reread it. It's good.
  • Examples in C# on CQRS and Event sourcing
  • Akka and event sourcing - stumbled across a tweet from scalarconf and I spotted this presentation by Konrad Malawski.
  • Description of EventStore's architecture
  • "If you sat down with them [a customer], explaining the long-term value of having an archive of all actions in the system, and they said OK, build this into the system from the beginning, that would be fine." - Dahan
  • Food for future thoughts: Reactive Design Patterns, Reactive Manifesto, SEDA, and Retrospective on SEDA.

[1] This may also mean that industry have come up with a marketable name for something researchers have been thinking about for a long time already.

[2] I got kind of frustrated/annoyed with this claim in Dahan's article: "How fast they get processed is a question of Service-Level Agreement (SLA) and not architecturally significant." To me it seems an SLA, determining much of a systems quality attributes, is definitely something architecturally significant. Maybe I just don't get what he's trying to say?

@hallgren
Copy link

hallgren commented Apr 8, 2014

I started learn about aggregate modeling from Vaughn Vernon´s papers.

http://dddcommunity.org/library/vernon_2011/

@larskrantz
Copy link

Greg Young - Why use event sourcing
and some course material he links to at the bottom:
Course material

@archie
Copy link
Author

archie commented Apr 8, 2014

@hallgren, @larskrantz: will take a look at those two and add to list!

@dgomesbr
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment