Our Blog

Ah... the beauty of inherited code. And of course I am not talking about class inheritance and nice OO practices, I am talking about someone else’s code, someone else’s work —does it deserve to be called work? Certainly not work of art!— that falls into our hands to amuse us, to awaken us from our daily routines, to make us indulge in the satisfaction of feeling that we "know better", or is it to torment us? That piece of beauty is there, in front of our eyes, to be fixed, debugged, extended or, even worse, perpetuated.

p>It seems to be easy and even entertaining to criticize others’ creations. That is why things such as The Daily WTF exist (which I actually enjoy), so we can all laugh at other people’s faults —never ours. It is also the reason why peer reviews and code inspections are not as popular as they should be (they are supposed to be one of the greatest testing tools available): because we don’t want people criticizing what we do or laughing at our work.

Therefore, when looking at this type of masterpiece, we have to realize that its author may have had a bad day, so he/she just didn’t want to bother thinking about more maintainable solutions (not even ask for more elegant solutions), he or she may just been not motivated enough: who knows what was paid to do that (I am pretty sure there is a direct correlation between monetary —or other— return and willingness to think a little longer), didn’t have enough time, or, in the worst case, just didn’t know any better. Hey, we’ll all been there. I don’t want to know what people is thinking while staring at my early lines of code (supposing I’ve improved), which unfortunately lie somewhere in a —hopefully not— running system.

Now, having said all that in order not to sound disrespectful, I have to share this. I just saw this in the database I am supposed to work with, while trying to make an estimate on how long it will take me to add some new functionality. Of course the following example is only one of the countless design faults that this system has, so “adding some new functionality” will probably cost them much more than it should, something they won’t understand and most likely won’t be willing to pay for.

This is a database table that has 120 columns, including this series of columns… Do you see the pattern?

Guess how big n is in this series: 25. So out of the 120 columns, 50 are this category + picture stuff, most of which are completely empty. They probably didn’t read this post by Joe Rinehart!

Laura

Laura

2 Comments

  1. anon
    poor bastard, welcome to my world...

    http://cfpurists.blogspot.com/2004/08/coding-horror-stories.html#c109228609096463753

    we've got a whole bunch of apps like this to maintain. if it's any consolation, I feel your pain

    keep smiling
    anon
  2. Jon Hopewell

    Jon Hopewell

    Laura,
    this is frequently true. However it is always easier to citicize others code than our own. What is elegant to me (embedded developer) may be trash to you. And of course the reverse.