About Ian Muir

Ian’s obsession with technology started when he received a Tandy TRS-80 for his 6th birthday and he hasn’t stopped coding since. He currently works as a web developer at Piehead in Portsmouth, NH. When Ian isn’t writing code he can usually be found at your local BarCamp.

Humor Through Comments

Photo Credit: Anders Rune Jensen

Over the years, sale I’ve developed some rather strange code commenting habits. While many of my comments have become second nature as I code, glands
every time I join a new team they raise some questions. For the most part they are intended to be both humorous and informative, viagra approved
but many have evolved over the years into inside jokes that require some explaining.

It All Started with Bananas and Idiots

My penchant for humorous code interjections started at one of my first programming jobs. The team worked with a few tools that threw warnings when functions and classes weren’t commented. So, we used the age old practice of adding the following comment:

//Banana banana banana

It kept our coding tools from throwing warnings and it was easy to find when we got around to commenting our code. Not long after learning the banana technique, a fellow programmer added a comment referring to ID10t errors. Unfortunately for the programmer, the client actually looked at the source code and was not fond of being called an idiot. These 2 experiences led me to create my personal rules of humorous code commenting.

The Rules of Humorous Commenting

  1. All comments should be useful, even humorous ones. Adding funny but useful comments is a simple way to lighten the mood. Adding useless comments will just annoy your fellow developers.
  2. You never know who will look at the code, so keep the comments clean. More Monty Python; less George Carlin.
  3. Save the funny comments for compiled code. Inside jokes are great, but you don’t need to push tons of technology humor on your users.

Now that you know the rules, here are some examples of comments that I use on a regular basis.

// Mostly Harmless
Used for code that might appear to be a security risk at first glance. A good way to let your fellow devs know that the code is secure.
// Abandon hope all ye who enter here
A notice that the following legacy code will probably take you days to figure out.
// I Call Shenanigans
Denotes code that is in place to prevent injection, xsrf attacks or other security trickery.
// You are here
Reminds me where I left off in a particular code file. Very useful when pulled into a random meeting or leaving something un-finished before the weekend.
// He who breaks the build shall pay a penance of donuts
Placed at the top of the main file or index file to remind devs what happens when they make me stay late to clean-up.

This is a Joke Right?

In reality, introducing some humor into your comments can have several benefits. It not only helps lighten the mood a bit; it also creates an atmosphere that encourages commenting your code. Finally, having a few inside jokes can help bring your team together, so get out there and have fun commenting your code.