A year with event sourcing and CQRS
Stephen Pember offers an introduction to command-query responsibility segregation (CQRS) and event sourcing (ES), techniques that help when working with complex systems with high user demand. Steve explores the individual techniques, discusses their usefulness, and outlines what ThirdChannel has learned after using ES and CQRS for the past year.
Talk Title | A year with event sourcing and CQRS |
Speakers | Stephen Pember (Toast) |
Conference | O’Reilly Software Architecture Conference |
Conf Tag | Engineering the Future of Software |
Location | New York, New York |
Date | April 11-13, 2016 |
URL | Talk Page |
Slides | Talk Slides |
Video | |
As businesses grow, so does the complexity of their software. New features, new models, and new background processes all continue to be added. . .and developers struggle to make sense of it all. Yet the end user demands a swift and functional experience when interacting with your application. It is paramount to be open to alternative patterns that help tame complex, high-demand services. Two such patterns are command-query responsibility segregation (CQRS) and event sourcing (ES). Command-query responsibility segregation is an architectural pattern for user-facing applications that extends from the now standard Model-View-Controller (MVC) pattern and is an alternative to the CRUD pattern. At its core, CQRS is about changing how we think of and work with our data by introducing two types of models: all user actions become commands, and a read-only query model powers our views. Commands and queries are logistically separated, providing additional decoupling of our application. CQRS also calls for changes in how we store and structure our data. Enter event sourcing. Instead of persisting the current state of our domain objects or entities, we record historical events about our data. The key advantage is that we can examine our application data at any point in time, rather than just the current state. This pattern changes how we persist and process our data but is surprisingly efficient. While each of the two patterns can be used exclusively, they complement each other beautifully and facilitate the construction of decoupled, scalable applications or individual services. Stephen Pember explores the fundamentals of each pattern and offers several examples and demonstration code to show how one might actually go about implementing CQRS and ES. Steve discusses task-based UIs and domain-driven design as he outlines some of the advantages—and challenges—that ThirdChannel has seen when developing systems using CQRS and ES over the past year. OFFICE HOURS Stephen will take part in Office Hours on Wednesday, April 13 at 12:15 PM in the Mercury Complex. Come by and meet him!