Prepare for a random thought > 140 chars:

I just read Ayendes post where he debates why we should not put an abstraction on top of NHibernate.

The reason to do such a thing would be to avoid coupling your code to the persistence layer. This in itself is not a bad idea until you take a deeper look at what is required to make a useful abstraction.

A simple persistence interface on top of NHibernate would make it easy to change the persistence layer but

  1. What happens when you need other features from NHibernate. Will you add it to the abstraction layer ? Not a very solid abstraction really.
  2. NHibernate is already an abstraction on top a relational database. Do you want to add another one ?

The term “Leaky abstraction” comes to mind.

F Share