18
Let’s Learn Together Ted M. Young @jitterted Developer & Agile Coach Guidewire Software, San Mateo, CA Intro to CQRS Silicon Valley Code Camp – October 9, 2011 Creative Commons Attribution- ShareAlike (CC BY-SA 3.0)

Intro to CQRS

Embed Size (px)

DESCRIPTION

My (minimal) slides from the presentation I gave a

Citation preview

Page 1: Intro to CQRS

Let’s Learn Together

Ted M. Young @jittertedDeveloper & Agile Coach

Guidewire Software, San Mateo, CA

Intro to CQRS

Silicon Valley Code Camp – October 9, 2011

Creative Commons Attribution-ShareAlike (CC BY-SA 3.0)

Page 2: Intro to CQRS

What’s the Problem

CAPConsistencyAvailabilityPartitionability

Page 3: Intro to CQRS

Can’t Have All Three

CAP: Choose TwoConsistency + Availability

Sacrifice PartitionabilityE.g., single database, clustered database

Consistency + PartitionabilitySacrifice AvailabilityE.g., pessimistic locking, distributed locking

Availability + PartitionabilitySacrifice ConsistencyE.g., optimistic locking, merging, expirationsMany systems are like this: eventually consistent

Whether you like it or not

Page 4: Intro to CQRS

BASE vs. ACID

Basically AvailableSoft-stateEventual consistency

Stale data is OK

Page 5: Intro to CQRS

What’s so bad about

Eventual Consistency

Page 6: Intro to CQRS

BASE is Not New

Inktomi Presentation in 1998

Page 7: Intro to CQRS

Not an either-or, but a spectrum

BASE vs. ACID

Page 8: Intro to CQRS

CQRS

Leans to BASE

Page 9: Intro to CQRS

CQRS is

Command Query Responsibility Segregation

Page 10: Intro to CQRS
Page 11: Intro to CQRS

http://www.udidahan.com/2009/12/09/clarified-cqrs/

Page 12: Intro to CQRS

Command

Mutator

Page 13: Intro to CQRS

Re-think UI

No more CRUD?

Stop The Forms

Page 14: Intro to CQRS

Query

With respect to the queried data

Read-Only

Page 15: Intro to CQRS

Resources: CAP, Other BackgroundBertrand Meyer

Command-Query Separation, §23.1 (p. 751)Object-Oriented Software Construction, 2nd Ed. (ISBN 0136291554)

Dr. Eric Brewer, InktomiPresentation (1998)

http://www09.sigmod.org/disc/disc99/disc/nsf_acad_ind/brewer/sld019.htm

Dan PritchettBASE and latency

http://www.infoq.com/articles/pritchett-latency

Prevaylerhttp://prevayler.org/old_wiki/Welcome.html

Page 16: Intro to CQRS

Resources: CQRS-Specific

Greg Young (no relation)

CQRS and CAPhttp://codebetter.com/gregyoung/2010/02/20/cqrs-and-cap-theorem/

Udi DahanGood overview

http://www.udidahan.com/2009/12/09/clarified-cqrs/

Martin Fowler’s CQRShttp://martinfowler.com/bliki/CQRS.html

Axon Framework (Java)http://www.axonframework.org

Page 17: Intro to CQRS

Resources: CQRS-Specific

Rinat AbdullinCQRS Starting Page

http://abdullin.com/cqrs/More useful info from Rinat with good PDF diagram

http://abdullin.com/xlim/

Pål FossmoAnother nice blog entry on CQRS

http://blog.fossmo.net/post/Command-and-Query-Responsibility-Segregation-%28CQRS%29.aspx

Page 18: Intro to CQRS

Thanks!

Follow me on Twitter: @jittertedEmail me: [email protected]

[Guidewire is hiring devs and testers!]

Final Questions?