Home » Software Development » Funny Source Code Comments

About Ilias Tsagklis

Ilias Tsagklis
Ilias is a senior software engineer working in the telecom domain. He is an applications developer in a wide variety of applications/services, currently the technical lead in a in-house PCRF solution. Particularly interested in multi-tier architecture, middleware services and mobile development (contact). Ilias Tsagklis is co-founder and Executive Editor at Java Code Geeks.

Funny Source Code Comments

I recently stumbled upon an awesome Stack Overflow thread, entitled “What is the best comment in source code you have ever encountered?”.

As you might have guessed, it is a collection of funny source code comments, provided by developers all over the world. Take a look at it, it could definitely make your day.

I am reposting here my personal favorites from that long long collection:

// sometimes I believe compiler ignores all my comments

Exception up = new Exception(“Something is really wrong.”);
throw up; //ha ha

//When I wrote this, only God and I understood what I was doing
//Now, God only knows
Tweet: When I wrote this, only God and I understood what I was doing. Now, God only knows. http://ctt.ec/79B28+

// I dedicate all this code, all my work, to my wife, Darlene, who will
// have to support me and our three children and the dog once it gets
// released into the public.

// drunk, fix later

// Magic. Do not touch.

return 1; # returns 1

double penetration; // ouch

/////////////////////////////////////// this is a well commented line

// I am not sure if we need this, but too scared to delete.

// I am not responsible of this code.
// They made me write it, against my will.
Tweet: I am not responsible for this #code. They made me write it, against my will. http://ctt.ec/94mkz+

//Dear future me. Please forgive me.
//I can’t even begin to express how sorry I am.

options.BatchSize = 300; //Madness? THIS IS SPARTA!

// I have to find a better job

// hack for ie browser (assuming that ie is a browser)

} catch (PartInitException pie) {
// Mmm… pie
}

// John! If you’ll svn remove this once more,
// I’ll shut you, for God’s sake!
// That piece of code is not “something strange”!
// That is THE AUTH VALIDATION.

try {

}
catch (SQLException ex) {
// Basically, without saying too much, you’re screwed. Royally and totally.
}
catch(Exception ex)
{
//If you thought you were screwed before, boy have I news for you!!!
}

// Catching exceptions is for communists

// If you’re reading this, that means you have been put in charge of my previous project.
// I am so, so sorry for you. God speed.
Tweet: If you’re reading this, you have been put in charge of my previous project. I am so, so sorry for you. God speed.. http://ctt.ec/ceBra+

// if i ever see this again i’m going to start bringing guns to work

// The magnitude of this hack compares favorably with that of the national debt.
Tweet: The magnitude of this hack compares favorably with that of the national debt. http://ctt.ec/bHara+

//ALL YOUR BASE ARE BELONG TO US

// If this code works, it was written by Paul. If not, I don’t know who wrote it

//You are not expected to understand this

/**
* If you don’t understand this code, you should be flipping burgers instead.
*/

‘NO COMMENT

//Abandon all hope yea who enter beyond this point

//Mr. Compiler, please do not read this.

catch (Ex as Exception)
{
// oh crap, we should do something.
}

// TODO make this work

// If you delete the credits, I will fucking kill you.

// This is crap code but it’s 3 a.m. and I need to get this working.
Tweet: This is crap code but it’s 3 a.m. and I need to get this working. http://ctt.ec/GHF_s+

// For the sins I am about to commit, may James Gosling forgive me
Tweet: For the sins I am about to commit, may James Gosling forgive me http://ctt.ec/97IK9+

// Houston, we have a problem

// If I from the future read this I’ll back in time and kill myself.

Pure awesomeness… Don’t forget to share your own favorites in the comments!

Related Articles :

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!

1. JPA Mini Book

2. JVM Troubleshooting Guide

3. JUnit Tutorial for Unit Testing

4. Java Annotations Tutorial

5. Java Interview Questions

6. Spring Interview Questions

7. Android UI Design

and many more ....

 

73 comments

  1. double penetration; // ouch

    kakaka Das ist geil! ^_^

  2. width:300px;
    /* 300 ? This is SPARTAAAAAAAAAAAAA ! */

  3. One of the comments I had it was as follows : 

    //why am I writing this piece of crap,It can make other’s life miserable..

  4. // Catching exceptions is for communists LOL

  5. This is an awesome read!!! 

  6. Comments are for hacks.

     If you need a comment, you’re doing it wrong.

  7. I have a few tame ones: 

    Advisory :
    *Code too complicated – Just read the comments In module description :
    *It also shoots off rockets to Mars and Jupiterand in the clean up para :*Music is over turn off the lights..  

  8. // Love me
    long time;

  9. Another simple one:

      double d; // cup

  10. A comment from my own shot at obfuscated programming (added to take up space and let me format the whole program into a nice little square).

    float gorF = main(args);//gorF is Frog backwards

  11. //i don’t know why but this seems to work.

  12. //Temporary hack for client. Remove on Monday.
    (Written 2002, found 2010)

    //This code does WHAT? … it doesn’t work…

  13. // TODO: Make this not sinfully ugly

  14. //this is my code

  15. I used to work with someone who would always comment line 42 with ‘The answer to life the universe and everything’. Everything.

  16. /**
    * just leave it as it is. if you don’t understand what this code does, then: u can’t touch this
    * http://www.youtube.com/watch?v=otCpCn0l4Wo
    */

  17. This is a one I found in some Microsoft Javascript on their site;

    // this is a fucking tragedy…it assumes that the genre filter is there too, since that’s valid for the only
    // case this is used in I’m leaving it like this, but it’s shit and should be fixed. just not now, or probably by me

    Find it here –> http://xbox.iconmobile.com/js/xbox3/main.js

    And I tweeted about it a long time ago haha –> https://twitter.com/djekl/status/159693087038373890?iid=am-45140289413269087931515100&nid=6+status_timestamp&uid=46642288

  18. anyone noticed …
    double penetration; // ouch

  19. Not a comment, but this comes from the source code for JIRA:

    ariseSirJiraAndUpgradeThyself();

  20. ‘Ok. There are two important things to remember when looking at this code.
    ‘Dino was here so a lot of the comments are for my benefit (testing stuff). And if something looks strange
    ‘it’s because I have no formal training in any “programming” discipline what so ever
    ‘so if you are trying to fix something here – sorry about your bad luck

  21. Girl girl = new Girl();
    Guy guy = new Guy();
    guy.IntroduceTo(girl);
    guy.StoreGirlPhoneNumber(girl.PhoneNumber); //crazy
    /*not sure, maybe*/
    //try {
    // guy.Call(girl)
    //}
    //catch (Excepcion e) {
    // throw e;
    //}

  22. if (event.detail==Alert.YES) {

    } else {
    // user chose no
    }

  23. my favorite from one of my previous work places was a code made in an inner company language, the used a language called cache’ (don’t ask! really you don’t want to know, and if you do know, I feel for you).
    the code was (translated to english) : New A Set A

    N A S A //we have a problem
    never got tired of seeing this one

  24. /* frame allocator */
    struct frame *falloc (struct page *);

  25. just awesome :D :D :D

  26. Dude that’s freakin awesome!!! :) Congrats!!! :D

  27. adnan abdollah zaki

    it’s really true . hahaha

  28. Great Article, Lol !

  29. Found in an Old COBOL program in the 80’s “Is it true that Frito Lays?”

  30. try {

    } catch (Exception e) {
    //silent as a ninja
    }

    one of best comments ever seen

  31. I think your busyforlunch condition is vice-versa

  32. just…..awesome!!!

  33. Well, not a comment, but this is in an objc project of mine:

    #warning this is so dirty I had to put porn on when my mom walked in

  34. Very funny! but from original post I liked this one:
    /*
    * You may think you know what the following code does.
    * But you dont. Trust me.
    * Fiddle with it, and youll spend many a sleepless
    * night cursing the moment you thought youd be clever
    * enough to “optimize” the code below.
    * Now close this file and go play with something else.
    */

  35. After commenting on some code in our code base, my co-worker wrote the following comments:

    // according to Avrom all this should be taken out to pasture and shot.
    // nah, it’s usable.
    // nah, it’s not.

  36. Nice post!! had a good time reading this. thanks for sharing….

  37. I’m never laughed over a computer related stuff like i did a minute by reading all the source code comments… Just too good!!!

  38. Just came across this double comment while going through some painfully horrendous legacy code:

    ‘=======================================================================================================================================
    ‘ We have events, so things get good here! <- what do you mean things get "good" here? Nothing is remotely good in this page ever!
    '=======================================================================================================================================

  39. /*We don’t care about performance, only accuracy because
    * we know IT can just throw a few more servers up up their asses.
    * We also don’t care if you can’t comprehend this, because you are
    * probably an offshore developer with poor English. */

    • Hey Stuart,

      I assume that’s a SQL Code comment block, right? I dislike SQL programmers that don’t optimize their code, they are just bad programmers… I wanted to get that off my chest.

  40. A friend of mine worked in the Houston office of Amoco (a large oil company), which later merged with PB. The following comments appeared next to an unknown error code…

    // Shut her down, Clancy. She’s pumping mud.

  41. \\ Awesomest post ever i Read
    \\ i have read this all lots time but never thought such type of blog post
    \\ incredibly collected.

  42. One I recently came across:

    // Initiate the matrix – not quite as sinister as it sounds

  43. Toto, I’ve a feeling we’re not in Kansas any more

  44. ################Good One############ Few More below…!

    // If this comment is removed the program will blow up

    try {

    } finally { // should never happen

    }

    Catch (Exception e) {
    //who cares?
    }

  45. — There is a bug here that I did not have the time to fix right now

  46. LOLz :) … This reminds me of similar funny comments we used to add in the log files.

  47. I use to put these…
    //Enter the new Dragon !!

  48. #DO NOT SHIP WITH THIS COMMENT INTACT!!

    #Fix what follows, I beg of you…

    //This does nothing useful, but the rest of this code fails to compile without it
    {
    return;
    }
    //Don’t bother wasting time figuring out why.

    /*
    * What is this code supposed to even do?
    */

    ##
    ## NO ONE WILL NOTICE, THEY SAID …
    ## WHAT’S THE WORST THAT CAN HAPPEN, THEY SAID …
    ## RUN THIS AND SEE FOR YOURSELF, I SAID.
    ## AND, LO, YOU DID
    ##

    // insert comment here
    function f(x,e);
    {
    printf “insert function to do stuff here”;
    }

    ** Boss man be mad when he read this code

    ** Only joking. Boss man never read code

  49. Haha, i had to put a few aside :D you never know when you’ll need to use them.
    Also, here are a few more :

    #define TRUE FALSE //Happy debugging suckers

    and a favorite of mine :

    //
    // 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
    //

  50. This reminds me: One time when I was trying to locate a source of performance issues, I finally found the right method, which contained:

    // TODO Can cause performance problems, fix in the future

  51. my favourites

    // – FFS what now it was working till you touched it

    popped up in many a log file for some reason

    // – leave me alone I might not be the prettiest but at least I work (unlike some)

  52. In the late 70’s I was told a story by a Control Data mainframe software engineer, I’m not sure it’s true, but it goes like this:

    One night two operating system engineers were sitting working on a set up updates to the next OS release. The junior of the two finds himself in a branch of code but is unsure what to do if it ever got executed. So he floats over to the senior guy and explains the situation. After thinking for a bit the senior guy says “That will never happen because…” and reels off a set of reasons demonstrating that he clearly understands WAY more than the junior guy. Mollified, but still unsure, the junior guy goes back to work.

    Within a month of the release going live, a mainframe experiences a critical stop. The message on the operator’s console read:

    “This can’t have happened, but it did, so tell Fred he owes me $50″

  53. ROFL!! Totally awesome… great collectioin.

  54. From the SysV unix timezone man page:

    “Beware making appointments with punctuality sticklers in Riyadh”

    Because, of course, Saudi Arabia runs on sun time…

  55. The following is the best known (and probably the oldest :) of such comments. This is from the Unix V6 kernel.

    /*
    * If the new process paused because it was
    * swapped out, set the stack level to the last call
    * to savu(u_ssav). This means that the return
    * actually returns from the last routine which did
    * the savu.
    *
    * You are not expected to understand this.
    */

    There are plenty of references on the Internet.

  56. // Happy debugging Suckers!

  57. love u Ilias. u make my day. gr8

  58. // Of all the code I’ve ever seen this is some of it.

  59. If (true){
    System.out.println(“funny and awsome”);
    }
    else
    {
    System.out.println(“Oppsss……….not understand”);
    }

Leave a Reply

Your email address will not be published. Required fields are marked *

*


− 5 = two

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close