Have you tried Flywheel? Learn moreJoin the best designers and creative agencies in the world. Learn more

×
7 entertaining comments left in code

7 entertaining comments left in code

If you’ve ever spent time writing code, you know that you can go through hours of frustration, occasionally being rewarded with satisfying but small successes.

Sometimes, during that frustration, developers take their anger out on their code by writing comments explaining their exact feelings.

Here are some gems (and not the Ruby kind) found within code comments or commit messages.

1. Found on a forum, this comment reminds us all that if we write unmaintainable code, we can ensure our job security:

// Dear maintainer:
// Once you are done trying to ‘optimize’ this routine,
// and have realized what a terrible mistake that was,
// please increment the following counter as a warning
// to the next guy:
//
// total_hours_wasted_here = 42

2. These commit messages remind us that even if our code is brilliant, being able to properly document your code commits is just as important.

commits

Check out the full sized original screenshot here.

3. Sometimes, you get so frustrated with someone else’s design that you just have to go on a rant. That’s what programmer “paracelsus” did when working on a piece of software that handles Photoshop files. He described his frustration in great detail in one of his source files:

/*
At this point, I’d like to take a moment to speak to you about the Adobe PSD format. PSD is not a good format. PSD is not even a bad format. Calling it such would be an insult to other bad formats, such as PCX or JPEG. No, PSD is an abysmal format. Having worked on this code for several weeks now, my hate for PSD has grown to a raging fire that burns with the fierce passion of a million suns.

If there are two different ways of doing something, PSD will do both, in different places. It will then make up three more ways no sane human would think of, and do those too. PSD makes inconsistency an art form. Why, for instance, did it suddenly decide that *these* particular chunks should be aligned to four bytes, and that this alignement [sic] should *not* be included in the size? Other chunks in other places are either unaligned, or aligned with the alignment included in the size. Here, though, it is not included. Either one of these three behaviours would be fine. A sane format would pick one. PSD, of course, uses all three, and more.

Trying to get data out of a PSD file is like trying to find something in the attic of your eccentric old uncle who died in a freak freshwater shark attack on his 58th birthday. That last detail may not be important for the purposes of the simile, but at this point I am spending a lot of time imagining amusing fates for the people responsible for this Rube Goldberg of a file format.

Earlier, I tried to get a hold of the latest specs for the PSD file format. To do this, I had to apply to them for permission to apply to them to have them consider sending me this sacred tome. This would have involved faxing them a copy of some document or other, probably signed in blood. I can only imagine that they make this process so difficult because they are intensely ashamed of having created this abomination. I was naturally not gullible enough to go through with this procedure, but if I had done so, I would have printed out every single page of the spec, and set them all on fire. Were it within my power, I would gather every single copy of those specs, and launch them on a spaceship directly into the sun.

PSD is not my favourite file format.
*/

4. When the Borland Turbo C 2.0 Reference Guide authors were bored, they apparently liked to write chicken-killing programs to leave behind for those who actually paged through the 583-page tome.

/* Emits a 7-Hz tone for 10 seconds.
True story: 7 Hz is the resonant frequency of a
chicken’s skull cavity. This was determined
empirically in Australia, where a new factory
generating 7-Hz tones was located too close to a
chicken ranch: When the factory started up, all the chickens died.
Your PC may not be able to emit a 7-Hz tone.
*/
main()
{
sound(7);
delay(10000);
nosound();
}

5. The robots.txt provides a great space for developers to have some fun, mostly because the biggest readers of those files aren’t human.

Youtube, for example, pays tribute to Flight of the Conchords with these three comments:

# robots.txt file for YouTube
# Created in the distant future (the year 2000) after
# the robotic uprising of the mid 90’s which wiped out all humans.

Last.fm decided to give potential web-crawling bots some extra instructions, hoping to preserve humanity by doing so:

Disallow: /harming/humans
Disallow: /ignoring/human/orders
Disallow: /harm/to/self

6. Sometimes developers can also go on rants during lightning talks, like Gary Bernhardt did while describing the amount of “wat” contained in both Ruby and JavaScript.

7. Lastly, although this isn’t specifically a code comment, we really appreciate our development intern Kevin’s T-shirt! Nothing says awesome like a Star Wars quote rewritten in Bash.

kev!!-1 copy
You can see more of Kevin’s awesome shirts on this Tumblr blog dedicated to his apparel.

Just remember: The next time you get stuck on a programming problem, write a great comment so you can laugh it off during code review.

Join the discussion

Share this article:
Get more great content in your inbox

More articles

Get content like this sent directly to your inbox!

Install WordPress locally free
[if lte IE 8]
[if lte IE 8]