Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Gentle introduction to CQRS

SeeSaw
September 15, 2015

Gentle introduction to CQRS

what if I say "CQRS + ES"? ... if you're already looking on wikipedia this talk is for you. CQRS and Event Sourcing introduction for acronyms haters. 100% fluff free

SeeSaw

September 15, 2015
Tweet

More Decks by SeeSaw

Other Decks in Programming

Transcript

  1. is an architectural pattern proposed by Greg Young that segregates

    reads and writes of a system into two separate subsystems. CQRS
  2. writes are usually asynchronous and stored in a transactional storage

    while reads are eventually consistent and retrieved from de-normalised views CQRS (details)
  3. BERTRAND MAYER Designer of Eiffel programming language Coined “open/closed principle”

    and “design by contract” Introduced command query separation (CQS)
  4. COMMAND • Command is the message to change state •

    Message handled by a CommandHandler • Returns void (so nothing) • Describes business intent • Immutable
  5. QUERY • Read state from data store • Does not

    change state • Has a return value
  6. WHY SHOULD I USE CQRS? • Scalability • Reduced complexity

    • Flexibility • Focus on the business
  7. CQRS MYTHS • is easy • CQRS = Event Sourcing

    and vice versa • requires an eventual consistent read store • requires a bus/queues/asynchronous messaging
  8. – Udi Dahan “Most people using CQRS (and event sourcing

    too) shouldn't have done so” – Greg Young “It's important to note though, that these are things you can do, not necessarily things you should do. Separating the read and write models can be quite costly” WHEN SHOULD I AVOID IT?
  9. CREDITS slide10 - www.defenceimagery.mod.uk - 45155579 slide 12 - https://www.flickr.com/photos/broeckxsven/

    slides 4,9 - http://martinfowler.com/bliki/ http://martinfowler.com/bliki/CQRS.html http://udidahan.com/2009/12/09/clarified-cqrs/ https://en.wikipedia.org/wiki/Command–query_separation https://cqrs.files.wordpress.com/2010/11/cqrs_documents.pdf RESOURCES