A short story about source code comments

Posted on December 7, 2011, under Tetzle

A bug was reported in Tetzle, and the reporter helpfully tracked down why it was happening but was not sure what the purpose of the offending code was. I took a look at the code and said, “Beats the hell outta me!” I’m lazy, so of course it was not commented. I traced it through git all of the way to the very first release, and then had to track down my ancient notes about what the purpose was (it turns out Tetzle crashes if you delete the image of the current game, so it was preventing that but not clearing it on launch—kind of obvious, really). I fixed the code and added comments so that I would know what the purpose of that code is if I ever wonder in the future. The moral of the story is: comment your damn code, you’ll need it someday. Of course, I doubt I will be diligent about that, since I’ve run into this exact same situation before. 😛

Categories