github twitter linkedin email
CQRS and Event Sourcing
Dec 29, 2018
2 minutes read

Back Online

Whew - it’s been awhile, but this blog is back online. It seems that changes to hugo broke the theme I was using, which resulted in something going wrong over at gitlab.

I have a goal of posting more information about eventsourcing & cqrs in the next while. In the meantime, check out anything on this list by Greg Young: (Awesome CQRS and Event Sourcing).

Why Event Sourcing?

Event sourcing has a unique advantage of being able to explicitly map to the problem domain without complicated abstractions.

When comparing this to crud/rdms systems, there are some downsides to using event sourcing:

  • more code to write
  • more components functioning at runtime
  • eventual consistency of read state

Those are problems, but I think we have to revisit the goal of what we are building in the first place. CRUD may not have those issues, but there are issues it does have that event sourcing / cqrs does not:

  • schema modelling decisions to make around scale & level of denormalization
  • limitations of only storing current state:
    • user intent lost
    • hard to prove that audits / logs are correct / complete
    • hard to prove that current state has not been modified
  • operational difficulties
    • complex queries using joins are more expensive
    • caching is hard to compensate for
    • transactions & locks can be difficult bottlenecks that occur at the most critical times

Everything is hard

Here is the thing - both are hard. The easy thing about CRUD is generating a db and basic models. However, this is not always a good first step to build a system. It all comes back to priorities of whatever it is we are building.

  • Does this system represent a competitive advantage for the business?
  • Is this system exposed to external systems?

If so, it’s hard to think of CRUD as a great fit.

What about RAD?

An interesting first step to event sourcing is called event storming. Here is an interesting tool to try: (webeventstorming.com).



Back to posts