The wages of sinInverse leaky abstractions

time to read 2 min | 321 words

This time, this is a review of the Sharp Commerce application. Again, I have stumbled upon the application by pure chance, and I have very little notion about who wrote it.

As you might have noticed, I am pretty big fan of the NHibernate Futures feature (might be because I wrote it Smile), so I was encouraged when I saw it used in the project. It can drastically help the performance of the system.

Except, that then I saw how it is being used.

image

Which is then called from CurrencyService:

image

Which is then called…

image

Do you see that? We take the nice future query that we have, and turn it into a standard query, blithely crashing any chance to actually optimize the data access of the system.

The problem is that from the service API, there is literally nothing to tell you that you need to order your calls so all the data access happens up front, and it is easy to make mistakes such as this. The problem is that there is meaning lost at any additional abstraction layer, and pretty soon whatever good intention you had when you wrote a particular layer, 7 layers removed, you can’t really remember what is the best way to approach something.

More posts in "The wages of sin" series:

  1. (24 Mar 2011) Hit that database one more time…
  2. (23 Mar 2011) Inverse leaky abstractions
  3. (22 Mar 2011) Proper and improper usage of abstracting an OR/M
  4. (21 Mar 2011) Re-creating the Stored Procedure API in C#
  5. (18 Mar 2011) Over architecture in the real world