Skip to main content

Event Sourcing is like Vector Graphics

I want to emphasize at the outset, that I am not an expert in graphics. 
I just have some basic knowledge, but based on that I was able to coin this parallel.

I assume, that you have some basic knowledge about Event Sourcing and CQRS, but if you don't please refer to this definition or watch Greg Young's mindblowing 6,5h long classes (if you already do have some knowledge, watch this video anyway - it is worth your time).
I also assume that you have some very basic knowledge about Vector Graphics and Raster Graphics.

What is an Event? Stop for a moment and think. Probably you will come up with an answer, that an Event is an Aggregate's state change which occurred. And this is a very good answer indeed.
Guess what. Vectors can depict the state change too! So Events may be treated as Vectors, right?

Below I will write down some similarities that Event Sourcing has with Vector Graphics, and 3rd Normal Form databases have with Raster Graphics.

1. Scaling up.
In Vector Graphics you can scale up the image and it won't lose the quality. The same is with Event Sourcing based application - you can easily scale them up without losing the quality of the code and design.
Have you ever scaled up a completely consistent, built on top of 3rd Normal Form database application? It looks just as scaled up Raster Graphics based image - let's just say "ugly". ;)

2. Breaking into smaller.
You can take some parts of Vector Graphics based image, and put them in another Vector Based image. Same with Events - you can break some module (Bounded Context) into two and take out all Events for particular Aggregate.
Have you ever tried to break the SQL database with an army of FK constraints? Or copy something out of Raster Graphics image?

3. Coupling.
In Vector Graphics when you modify one object, the others are not touched. The same is true with Event Sourcing - only one Aggregate is changed.
Have you tried to change the SQL database schema? It is like drawing on a Raster Graphics based image without layers. It requires a lot of precision -another way you may end up with a real mess...

Tools.
You may disagree - we have Hibernate and Envers - we have Photoshop and Gimp.
Yes, we have - those are great tools, that make working with 3rd Normal Form databases and Raster Graphics based images a lot easier.
But from the other side, they are hard to learn, hard to work with (when really big scale is the key) and they have some serious limitations.

So, I am leaving you with this metaphor. Do you see any other similarities? Or maybe differences? Let's discuss. ;)

Comments

  1. Nice metaphor...
    At the first moment (reading just title of the post) i thought: hmmm raster is just a "projection" of the vector model just like read (ex. sql) model just a projection of events model.
    I don't know if it was Your intention, but I can no see it explicitly witted:p

    ReplyDelete
    Replies
    1. Heh actually... I didn't thought about this. :)
      But You are completely right! Yet another similarity. :)

      Delete

Post a Comment