Sponsored By Aspose - File Format APIs for .NET

Aspose are the market leader of .NET APIs for file business formats – natively work with DOCX, XLSX, PPT, PDF, MSG, MPP, images formats and many more!

Event Storage and Persistence Ignorance

Someone brought up to me that they commonly hear concerns about persistence ignorance when dealing with a domain that uses event sourcing. The reasoning behind this is that the domain object knows about the events and rebuilds from them and is therefore not persistence ignorant. This is untrue.

 

One could store the events in a relational database.

One could store the events in a document database.

One could store the events in a file with binary serialization

One could store the events on pieces of paper that were typed into the system when they were needed (though this would not be very efficient for most systems).

 

the fact of the matter is that we could turn the logic of this statement around and say a typical system is not persistence ignorant because it can only be stored by representing its current state. A typical domain model cannot be stored as a series of events that are replayed to represent its current state so it is therefore not persistence ignorant.

To illustrate

One could store the snapshot of current state in a relational database.

One could store the snapshot of current state in a document database.

One could store the snapshot of current state in a file with binary serialization

One could store the snapshot of current state on pieces of paper that were typed into the system when they were needed (though this would not be very efficient for most systems).

 

Both can in fact be persistence ignorant, it is just that we have different kinds of methods of storage, snapshot current state verses a history. You cannot be persistence ignorant between the two different types because they are just different. Again and this is the second time I am writing this today, things are just different.

This entry was posted in Uncategorized. Bookmark the permalink. Follow any comments here with the RSS feed for this post.

One Response to Event Storage and Persistence Ignorance

  1. Adam D. says:

    The easier argument would be to note that the domain changes with time. Hence, the domain is the only thing that knows how to react to events generated by previous versions of itself.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>