10 “Best” Code Comments

8 Nov

A colleague at work forwarded this link on our Dev chat channel and led me to a good session of unproductive hilarity. Code comments, when they are present, are a reflection of the personality of the programmers and it is great to see that as a community, we have quite a good sense of humor. I’ve compiled in the following list the 1o comments I found were the most hilarious or relevant. Of course this is my Top 10 and thus highly subjective:

  1. // 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 = 39
  2. /** * For the brave souls who get this far: You are the chosen ones, the valiant knights of programming who toil away, without rest, fixing our most awful code. To you, true saviors, kings of men, I say this: never gonna give you up, never gonna let you down, never gonna run around and desert you. Never gonna make you cry, never gonna say goodbye. Never gonna tell a lie and hurt you. */
  3. Exception up = new Exception("Something is really wrong."); throw up;
  4. // somedev1 - 6/7/02 Adding temporary tracking of Login screen
    // somedev2 - 5/22/07 Temporary my ass
  5. #define TRUE FALSE //Happy debugging suckers
  6. if (/*you*/ $_GET['action']) { //celebrate
  7. // If this code works, it was written by Paul DiLascia. If not, I don't know who //wrote it.
  8. //When I wrote this, only God and I understood what I was doing
    //Now, God only knows
  9. // drunk, fix later
  10. // Magic. Do not touch.

Visit the link for more nuggets and context on some the comments listed above. What is the “best” code comment you ever saw?

11 Responses to “10 “Best” Code Comments”

  1. Developer Dude November 8, 2011 at 5:02 pm #

    Worst comment I ever saw:

    // Comment goes here.

  2. Patrick Cornelißen November 9, 2011 at 9:18 am #

    IMHO the worst are these:

    //Setting foo to 7
    foo=7;
    //Check if bar is true
    if(bar){…}

  3. Bad Developer November 9, 2011 at 10:13 am #

    To be fair, #3 isn’t a comment.

  4. SteveRob November 9, 2011 at 10:25 am #

    No. 7 is awesome!

    • Steve November 9, 2011 at 11:42 am #

      Nice compilation ;) Several of them could be from my university assignments (post-drinking hacking was considered cool) :)

      One of my real-live favorites is:

      try {
      ..
      } catch (SomeException e) {
      // swallow
      /*
      * somedev1: what do you mean? african or european swallow?
      * use http://style.org/unladenswallow/ for refrerence
      */
      }

  5. dbunic | www.redips.net November 10, 2011 at 2:47 pm #

    6. is my favourite – nice PHP line!

  6. Fredo May 15, 2012 at 7:33 am #

    Some months ago I found this comment while digging through code:

    // They made me do it

Trackbacks/Pingbacks

  1. Blague de programmeurs - The Chronicles of SekhmetDesign: The Blog - November 9, 2011

    [...] 10 “Best” Code Comments « The Technological Africans Blog. Be Sociable, Share! There are 0 comments to this post. Add Your Comment. [...]

  2. Juick Digest November 10, 2011 | Циничный романтик - November 9, 2011

    [...] @Daemon: *dev Комментарии в коде. aboukone.com [...]

  3. 10 “Best” Code Comments | Syngu - November 10, 2011

    [...] A colleague at work forwarded this link on our Dev chat channel and led me to a good session of unproductive hilarity. Code comments, when they are present, are a reflection of the personality of the programmers and it is great to see that as a community, we have quite a good sense of humor. I’ve compiled in the following list the 1o comments I found were the most hilarious or relevant. Of course this is my Top 10 and thus highly subjective.    News Read the original post on DZone… [...]

  4. 5 Types of Comments to Avoid Making in Your Code - November 11, 2011

    [...] Update (11/11/11): I found some additional funny code comments: 10 “Best” Code Comments [...]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 453 other followers