While I’m technically classified as an engineer, I’ve spent a lot of time writing and debugging code over the years. As any decent coder will tell you, it is important to comment your code. This helps others make sense of what you’ve done and helps you if you have to revisit your work several months after you initially wrote it.
While I have always understood this principle, I haven’t always applied it very well. I suspect this is because I wasn’t considering having to revisit any of the work, and I thought it would likely never be read by someone else. But as they say, never say never.
Many years ago I was working on a small part of a much larger software task that was not going well at all. We were rushing headlong towards the deadline and were concerned that we wouldn’t be able to complete everything required for the task. Naturally many of us wound up working late many nights. A general sense of foreboding hung in the air, and everyone’s nerves were more than just a bit frayed. So it was pretty easy have little things slip your mind. Things like removing weird comments from your code.
Ever since my college days, if I was writing code and needed a dummy variable to test something, I would use the word “bob”. I suppose this started because “bob” is easy to type and just a little weird. Now if I got into a situation where I would need a second dummy variable, I would use “ray”. While a bit more difficult to type than “bob”, it added a little extra weirdness to things since it completed a reference to a slightly obscure comedy team from years ago called Bob and Ray, naturally.
Now I’m not an aficionado of comedy teams from the 50’s and 60’s. In fact I’m not really all that familiar with their work. But Bob Elliot is the father of Chris Elliot and appeared on his show “Get a Life”. And I am a HUGE “Get a Life” fan. But that is a topic for another
therapy session post.
But getting back to my original story…To ease some of the tension of the quickly sinking task, I used “bob” and “ray” in come of my code. I even added a comment explaining who they were. Now I had no intention of leaving any of it in the code, but things got hectic, and I got forgetful. And I never had a second thought about it until several years later when a coworker from the task had to go back and check out the software for some reason or other. Sure enough, he stumbled across my comment and informed me that I had neglected to remove it.
So I guess the moral of the story is: Always include clear, useful comments in your code. Secondly, try to avoid using bizarre variable names. Thirdly, if you use weird variable names, don’t include an even weirder explanation for the variables. And fourthly, never base your weird variable names on your affinity for a short-lived comedy that will never, ever, ever, ever come out on DVD. EVER!