Suspecting already used code

By | June 22, 2008

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!

One thought on “Suspecting already used code

  1. MohammadJ

    Salam

    You had shown a great skill there, unfortunately, most of the time as you alreay saw , we deal with other’s code as if it was a holy thing , we dont suspect it (which is wrong), most of the time , a little bet of refactoring would solve a LOT of issues, but like i was told once and am quoting here
    “We Are Working In A Fast Track Developement, We Shall Expect Such Changes” … I just noded my head , sho beddak tqollo ha9′ 😀

    Thanks

Leave a Reply

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