I decided to start working on a simple example, a bank application, that shows how aggregates can be modeled using Diyes.
The aggregate I decided to model is a bank account, it will exemplify some basic concepts of aggregate modeling. First of, we create a class that inherits from AbstractAggregate
public class Account : AbstractAggregate
How we normally go about modeling aggregates is we expose methods which are the commands that can be performed on our aggregates. So in this case I decided to have an Open, a Deposit and a Withdraw method. First thing we do in these methods is checking the preconditions for their execution, if the preconditions are met, we apply an event describing what happened. Continue reading diyes: practical modeling of aggregates
After we have seen how the event store works by saving and loading events related with an identity, in this post I am going up in the abstraction layer and talk about aggregates. A very good introduction to aggregate design can be found in Vaughn Vernons’ articles – Effective Aggregate Design.
Continue reading diyes: time for aggregates
For the more lazy ones that decided to skip the event sourcing literature that I suggested in my first post, I will try to explain a bit of how it works. Bear in mind, I am myself try to get to understand better how Event Sourcing (ES) and CQRS so my explanations might not be the best.
So basically, instead of having objects containing a state to represent our business objects, with event sourcing we have a sequence of events that describe what happened to our aggregates (in ES these business objects are called aggregates).
Continue reading diyes: laying the foundation
So the other day I was thinking to myself I wanted to know a bit more about event sourcing (ES) and the Command Query Responsibility Segregation pattern (CQRS). I have used ES before in a project before but I used library which was’t made by me. This gave me knowledge on how to model a domain using events but it didn’t give me the “down to the iron” experience of it. So I thought, what better way to learn about ES than by implementing a ES library myself.
Continue reading diyes: the event sourcing library