Bad Code

I have some serious issues with what I am about to say, but please bear with me.

Development is as much an art, as much a science, as much a skilled and science driven thing, as air is fun to breathe. Sometimes I get energetic about being able to expand my rib cage and feel the cool air flowing through into my lungs, helping me expand them more, and I continue expanding until I cannot quite expand them any more and I sit. I stretch out my rib cage, allowing my muscles to wonder when they are going to receive their oxygen and close my eyes. It is a lot like holding my breath, only I am not intending to turn blue.

However, this does not always apply. Far more often I find myself looking at code like its air that’s full of smog, and I know I am about to hate every moment of what is following. My breaths are short and sickly, almost forcing the vile material from the deep caverns.

What makes a man love to code and hate code at the same time is what have come to be called Hacks. These often ignored and imperceptible items become utterly irritating when handed off for countless reasons. Even more people than I have taken time out of their well-defined schedules to rant about such topics. Just as I look at a blue canvas and don’t see art, and look at a toilet in the middle of a museum and see a toilet in the middle of a museum and not art, I look at bad code and hate it for what it is, bad code.

Bad code is what is used to “make things work” when functionality is not the only trade off. Things like global variables, using #define to encapsulate complicated things, or being all around bad in your conventions are all examples from the last month that have all come back to haunt original authors of this bad code, down to the point where functions are written as follows:

sub setvar
    ($varname, $key, $val) = @_;
    ${$varname}{$key} = $val;

Being a proponent to refactoring code and providing my time for such things do not often lead to anything changing, mostly because of fear; although, I am not sure what the fear is of.

May I please make the suggestion that you don’t bother coding something if you don’t have the ability to code it right? I know “code it right” is a vague term, but I have always had a feeling I was coding something wrong when I was doing as such, and id like to believe that I know when I’m moving in the right direction when I am.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.