What exactly is “persistence ignorance”?

I would claim that, like most things, its a sliding scale. There are things that we make that want to have the property of persistence. On one end of the scale is this thing having all of the guts, dependencies, and code that is custom built to persist just this one thing in its particular way. On the other end of the scale is something that just magically happens, all without us doing much more than adding a token or setting a property somewhere that causes that thing to ‘just persist’. In order to get to the magical side of the scale, there are frameworks, design guidelines, conventions, etc that assist the magic in happening. I think you could argue that a tool could be produced that had fewer requirements and restrictions than NHibernate but pursued the same goal; that hypothetical tool would be further along our scale.

I don’t know that I like the term ‘persistence ignorance’ so much; its really about an object being ignorant of the implementation, the backing store, the cache, that sort of thing – an object is typically aware of whether or not it is persistent, though. But that’s just semantics.

Leave a Comment