Blog Logo
TAGS

Slim Your Aggregates with Event Sourcing!

Event Sourcing is a technique used to model a system’s domain using an append-only store of events. In this article, Oskar Dudycz explains Event Sourcing and how it can help reduce the size of aggregates. Traditional approaches often store a write model directly as a read model, leading to overcomplicated business logic. By decoupling write and read models, Event Sourcing simplifies the development process and supports easier debugging. The article provides an example of modelling a shopping cart aggregate using Event Sourcing, explaining how to add and remove products, cancel and confirm the shopping cart, and manage the cart’s status. The code example presented in the article illustrates how to implement the ShoppingCart aggregate using C#. Overall, the article provides a comprehensive introduction to Event Sourcing and offers a practical use case for the technique.