On Quotes and Bugs




            I like quotes. They're fun to read. Some are funny, others are insightful. Some days, I'll spend close to an hour just reading quotes. I've recently gone on one of my quote-reading adventures and came across this quote attributed to Harlan Mills.

- "The only way for errors to occur in a program is by being put there by the author. No other mechanisms are known. Programs can't acquire bugs by sitting around with other buggy programs."

I like this quote because it reminds me of how some programmers behave when someone discovers a bug in their code. They like to pretend that they didn't put it there. But, if they didn't put the bug in THEIR code, how did it get there? Somebody had to put it there, and it's YOUR code...you've been the one writing it. You've been the only one working on it, so that means you put it there. Logic is an important part of programming; you can't just throw it out the window when it's convenient. 

It's easy to see why some people do this. They want to be good programmers. They want to be seen as good programmers. Inexperienced or not-so-knowledgeable programmers seem to think that the best programmers never have bugs in their code. Well, here is another quote. This one attributed to John Jacobs (I'm not sure who he is, I tried google, but didn't find any real information on him)

- "Software is written by humans, and therefore has bugs."

EVERY programmer has written bugs into their code at one point, usually when it's something really important. It's okay if there is a bug in your code. In fact, it's normal if there are bugs in your code. If you think you may have written bug-free code on the first try, then either 1) You didn't write anything complicated enough to contain any bugs, or 2) Buckle up because you're in for a bumpy ride. Something is horribly wrong, but you won't discover it until the worst possible moment. 

I've put plenty of bugs into live applications (not so much that I would consider myself a bad programmer, but enough to make me realize that a bug in a live application isn't the end of the world....). It surprises me when a programmer tries to "cover up" or excuse away a bug as something that they didn't do. I used to do it when I first started programming. Here are some excuses that I have heard and even used myself before I knew better:

          "I didn't write that. Somebody must have changed my code." 
          "That's not what I wrote...something fishy is going on here."
          "The complier must have done something to my file."
          "Well, for some reason the program was trying to do this."
          "I'm pretty sure I wasn't the last person to touch this code."

          While the first and last excuse in that list could legitimately happen, I'm not talking about the rouge programmer going around changing code and not telling anyone about it, not yet anyway. I'm talking about when the bug was introduced by the programmer who is trying to avoid the fact that they were the ones who produced it.

          Now, there is a special class of bug-excuse that I feel is worse than any other. That's where a programmer fixes a bug in a live application and pretends that it never even existed. This goes beyond the simple excuse one makes about a bug in their code so that others don't think poorly of them. This breeds distrust between the users of an application and the programmer or group responsible for its maintenance. When a bug is discovered in a live application, normally it is because a user reported abnormal behavior of the application (unless tests are constantly being done on the code, which is usually not the case once an application goes live). This means that the abnormal or "buggy" behavior is already known to the users. They KNOW it exists. What happens through is the programmer will blame the bug on something that the user did, either they inputted some bad data, or they did a sequence of events out of order, or the mysterious "something" to break it. The programmer will go through the code and fix the problem, but instead of telling the user what the problem was, how to recover whatever data may have be lost or how to recover from whatever error occurred and that it is now fixed, they'll give the user some advice on how to recover from their "mistake" and conveniently leave out any mention of a bug in the code or what was affected or fixed. I guess these programmers think that the users will just forget that the incident had ever happened. Users are like elephants...they don't forget. The only thing that the programmer did (besides fixing the bug) was either 1) make the user wary of using the application (this is not what you want) or 2) make the user angry that you have decided not to fix the problem (when in reality you did) and wonder what else is possibly broken (distrust). 

          Many companies release patches for their applications. Most of the time there is a document called Patch Notes that is also released that details the various bugs in the old code and what they affected. Microsoft does this. Apple does this. Blizzard does this. If these big name companies, who definitely have some bad-ass programmers working for them, are okay with telling the world about the mistakes they have in their code, you should be fine with it as well. In the previous scenario with the "bug doesn't exists" programmer, I would have told the user that I'd investigate the problem, find and fix the bug, then tell the user that I've found the problem and corrected it. I would have given them steps to either recover any data they may have lost (if possible) and then sent an email to other users or whoever was responsible for communicating users when details of the bug, what it affected, and that it was now fixed (like a tiny patch note document). People are less likely to work with others who they feel they can't trust and the same goes for people working with applications. If they can't trust the programmer or team responsible for the application, then they can't really trust any applications they put out.

          I end this post with one last quote. This one being an anonymous quote as far as I know.


- "Blame doesn't fix bugs. Instead of pointing fingers, point to possible solutions. It's the positive outcome that counts."

No comments:

Post a Comment