Suspecting already used code

Filed Under (Development) by Emad Alashi on 22-06-2008

Tagged Under : , , ,

In one of the modules I am working on, my unit tests used to take tremendous amount of time (4 minutes per test  clip_image001). I inherited the NHibernate config file from previous NHibernate test module that was used somewhere before!

At the beginning I thought that this is something common when you use NHibernate with rich applications, so I didn’t pay much attention, but then it became a real headache.

One of the best colleagues notified me about an important note, which is that I was loading other domain objects from a shared  module (which I didn’t really need).
I checked the NHibernate config file, and removed the mapping line that includes those shared domain objects, and the time shrank to 15 seconds!clip_image002

The moral of the story is that it’s ok to suspect code we inherit from others, other modules or projects, we might not gain anything by doing that, but I am almost sure that we won’t lose!