Code Comedians

« Return to Article
  • wraith 2012-11-21 08:05
    I remember a comment I once wrote myself.

    // setting sibling0 as the parent of all other siblings (incest)
  • Nappy 2012-11-21 08:13
    [DontTazeMeBro]
    Probably part of the Share the pain program
    http://www.metacafe.com/watch/88657/share_the_pain/
  • Arkady 2012-11-21 08:15
    I did a project with a very extensible physics engine. I was extending it to include a "Flash" behaviour:

    class Flash /*AaaaaAAAAAAHHHHH!*/ : public PhysicsBehaviourBase
    /* Saviour of the Universe! */
  • Remy Porter 2012-11-21 08:20
    DIIIIIIIIIVVVVVVVVEEEEEEEEEEEEE.

    Man, BRIAN BLESSED makes everything better.
  • Warren 2012-11-21 08:24
    Perhaps CometWorkers.OnFirstJoint has been triggered too much, leading to Comet's - major UK electrical chain's - recent demise.
  • LoremIpsumDolorSitAmet 2012-11-21 08:25
    //Don't expect much work to get done after this event is triggered
    CometWorker.OnFirstJoint += new FirstJointObjects(CometWorker_OnFirstJoint)


    That must be triggered first thing every morning at Comet given my experiences there.

    Edit: well damn! Warren inb4 me!
    Edit2: and after me, too.
  • Warren 2012-11-21 08:25
    Perhaps CometWorkers.OnFirstJoint has been triggered too much, leading to Comet's - major UK electrical chain's - recent demise.
  • PK 2012-11-21 08:25
    One of the best I have seen was:
    "Oh magic numbers, guide us to the light!"
  • Smug Unix User 2012-11-21 08:30
    Sadly source control and peer reviews remove most of the funny comments or clever variable names.

    marypoppins = (superman + starship) / god;

  • PedanticCurmudgeon 2012-11-21 08:31
    Warren:
    Perhaps CometWorkers.OnFirstJoint has been triggered too much, leading to Comet's - major UK electrical chain's - recent demise.
    Apparently, Warren.OnFirstJoint has also been triggered at least one time too many.
  • Cbuttius 2012-11-21 08:40
    These should be CodeSODs

    but then yesterday's should have been a feature article, as it was not so much about the bad code but the developer's reaction when he wanted to fix it.
  • n9ds 2012-11-21 08:40
    "Brian claims that [DontTazeMeBro] is never returned . . "

    Sounds like another episode of "Famous Last Words"
  • Remy Porter 2012-11-21 08:44
    Hunh. I thought I had made it a CodeSOD. One too many triggers of OnFirstJoint, apparently.
  • Simon Peyote Joints 2012-11-21 08:44
    Great, so now we're gonna get all the HILARIOUS comedians in the comments telling us all the HILARIOUS things they've written in code.
  • Mark Bowytz 2012-11-21 08:48
    I see your CodeSOD and raise you a Coded Smorgasbord in honor of it being Thanksgiving Eve....and today's article a bunch of CodeSODs.
  • ¯\(°_o)/¯ I DUNNO LOL 2012-11-21 08:54
    I once put a series of "All your base register belong to us" comments in some hardware initialization code.

    base->register = data; // Move zig.

    return; // For great justice.
  • ZPedro 2012-11-21 08:58
    Off the top of my head, what I can think of is that I have seen The Doors' "This is the end" referenced in both the (completely unrelated) codebases I have professionally worked on so far.
  • Virus? 2012-11-21 09:08
    I once thought I had a bug in my code. After hours of searching, I found the culprit. A Windows DLL file. The name of that file:
    HASPMS32.DLL

    I was dumbfounded and thought I had a virus. Nope, that was the actual DLL file.
  • KattMan 2012-11-21 09:12
    The best I ever did was not easily seen in the code but was obvious to one single user of the system.

    This was one of those Director types that actually still wanted to do work. Commendable in most cases, but he would delete something then come running into the lab saying it was an accident and ask us to recover it. Granted it was simply flipping a flag on the record, but we made the mistake of making it look easy a few times so he never saw the prolem with interrupting us with something he should have been more careful with.

    That is until the next release triggered only by his login credentials.

    User: delete
    Dialog Box: Are you sure? yes no
    User: Yes
    Dialog Box: Positive? yes no
    User: Yes
    Dialog Box: Are you certain? yes no
    User: Yes
    Dialog Box: Absolutly? yes no
    User: Yes
    Dialog Box: Sorry <Director's Name> automatic recovery initialized.

    Bringing him right back to where he was, attempting to delete again would follow the same script, he had to get his secretary to delete it for him (yes another WTF, she had access to do this, but we never saw a mistake from her). He came walking into the lab and said, "Okay, I get it guys, can you fix it for me?" He was told yes, but had to wait for the next release. From then on he was a bit more thoughtful when the "Are you sure?" message box popped up, fearing the never ending cycle returning.

    At least he had a good sense of humor about it and none of us got yelled at for it.
  • Anom 2012-11-21 09:38
    Arkady:
    I did a project with a very extensible physics engine. I was extending it to include a "Flash" behaviour:

    class Flash /*AaaaaAAAAAAHHHHH!*/ : public PhysicsBehaviourBase
    /* Saviour of the Universe! */


    this ˆ
  • Rodnas 2012-11-21 09:40
    I once found a comment like this in some serious code is was working on:


    //This code is real sucky, sucky. Me Love you real good. Me love you long time.


    Well, you get the movie reference.
  • me_again 2012-11-21 09:41
    My favorites are checking isDirty on private members
  • just stop it 2012-11-21 09:50
    Simon Peyote Joints:
    Great, so now we're gonna get all the HILARIOUS comedians in the comments telling us all the HILARIOUS things they've written in code.


    Better than a useless prediction.
  • @Deprecated 2012-11-21 09:53
    This is from someone who left my company a while ago:

    // !xxx! the if/endif was added a long time ago
    // with some commit comment about an 'audio chicken'...
    // this effectively causes the minimum resolution to
    // be used *always*, i.e. even during idle periods
    // when we aren't even in a call!


    and

    // Nelson says we need this "for things that you don't understand"
  • theunknownsleeper 2012-11-21 10:05
    WordPress uses the variable $pee to represent <p> in the markup. Found this little gem in the codebase:

    $pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag
  • Ex-Dev 2012-11-21 10:15
    This reminds me of an error we had to troubleshoot about ten years ago while consulting for a customer in the transportation industry:

    Our support team received a ticket from an internal user of our reservation system. Apparently the sales clerk had received a pop-up window with the error message:

    "RAAAAAHH. BRAINS. MUST FEED."

    Our first thought was that someone had added this code at the last minute into our newest released version. However, examination of our entire codebase and version control history provided no hits (obfuscated or otherwise). Eventually we came to the conclusion that this message was being passed back from our 1970's-era back end system (implemented in COBOL, of course) and being displayed as-is.

    Since we didn't have the source code for the other system, our investigation stopped there. However, the original system had been in use for roughly 25-30 years and our own system had been in use for around 7 at the time. This error had never been reported before and was never seen since (the application was eventually retired a couple of years ago). It would be interesting to know what set of special circumstances triggered this dormant joke and how long it had lain in waiting.
  • AGray 2012-11-21 10:19
    Two drums and an asynchronous JSON response fell down a hill. Ba-da-BOOSH! :D

    CAPTCHA: facilisi - The silliness of the article facilisitated the poor joke above! But not this one.
  • d 2012-11-21 10:30
    I remember reading my old code, and a particularly ugly hack was commented:

    "Forgive me future David."
  • dbomb123 2012-11-21 10:31
    So, I shouldn't name all references to objects with a 'transform' method after autobots?
  • AGray 2012-11-21 10:33
    TransformObject bumblebee = new Transform();
    
    TransformObject optimusPrime = new Transform();


    That would be an awesome codebase. However, it would probably A)insta-fail a code review, therefore B) being rewritten so quickly, the world would fail to experience the awesomeness.

    CAPTCHA: nulla - In other words, you can count on that being nulla possibilities. Ba-da-BOOSH! :D
  • neminem 2012-11-21 10:50
    I try not to commit anything that would confuse people... but occasionally I can't resist turning legitimate things that look like emoticons, all the way into emoticons. Like, say, if you're sticking an underscore into the middle of a string:
    string newString = string1 +"_"+ string2;

    How can you -possibly- resist turning that into:

    // o // "beep beep, I am a robot"
    // |
    string newString = string1 +"_"+ string2;


    Also, that quote about joints, reminds me, I've always wondered how that song about smoking two joints didn't trigger a stack overflow of joint-smoking:

    void SmokeTwoJoints()
    {
    SmokeTwoJoints(); // smoke two joints before you smoke two joints
    (new Joint()).Smoke(): // smoke the two joints
    (new Joint()).Smoke():
    SmokeTwoJoints(); // then you smoke two more
    }
  • Evo 2012-11-21 11:03
    neminem:

    Also, that quote about joints, reminds me, I've always wondered how that song about smoking two joints didn't trigger a stack overflow of joint-smoking:

    void SmokeTwoJoints()
    {
    SmokeTwoJoints(); // smoke two joints before you smoke two joints
    (new Joint()).Smoke(): // smoke the two joints
    (new Joint()).Smoke():
    SmokeTwoJoints(); // then you smoke two more
    }


    Too bad you'll never actually come around to smoking a joint like that.
  • KattMan 2012-11-21 11:05
    Evo:
    neminem:

    Also, that quote about joints, reminds me, I've always wondered how that song about smoking two joints didn't trigger a stack overflow of joint-smoking:

    void SmokeTwoJoints()
    {
    SmokeTwoJoints(); // smoke two joints before you smoke two joints
    (new Joint()).Smoke(): // smoke the two joints
    (new Joint()).Smoke():
    SmokeTwoJoints(); // then you smoke two more
    }


    Too bad you'll never actually come around to smoking a joint like that.

    How do you know? Perhaps he has.
  • BOFH 2012-11-21 11:46
    KattMan:
    he would delete something then come running into the lab saying it was an accident and ask us to recover it. Granted it was simply flipping a flag on the record, but we made the mistake of making it look easy a few times
    Yes, clearly a mistake, for which you will pay and pay and pay...

    By policy, the following requests always take a minimum of 24 hours to resolve:

    * Forgot my password
    * Deleted my file, restore from backup
    * Unable to read what's right there on the screen in front of me

    It's called demand management. Make it easier for them to do the right thing the first time. It's really for their own good, in the long run.
  • Jack 2012-11-21 12:00
    While taking my college programming courses I got a part time job doing utterly brainless work on an old CRT based system. At the end of each action it would prompt:

    SYSTEM READY
    >

    Being incredibly bored, I discovered I could use the cursor keys to modify the message, then backspace to erase it from the input buffer so it wouldn't become part of the next command. One day at the end of my shift I left my station saying:

    SYSTEM READY FOR COMBAT
    >

    The next day the supervisor reprimanded me. Just because I was taking computer classes didn't mean I could reprogram their system. She said the next shift was afraid to use that station and they lost productivity as a result. I showed her how much difficulty and technical acumen was required to "reprogram" the system. She was, still, not amused.

    OK, not humor in source code, but she thought it was.
  • Spewin Coffee 2012-11-21 12:29
    Found this gem in our code repository:

    // "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
    //
    // Drat. Well...it was a nice life.

    Followed by a really detailed description of why the file the comment was found in is such a mess. Perhaps to appease the future maintainer of the code into not murdering them?
  • asd 2012-11-21 12:44
    $months = array('Nullember', 'January', 'February' , ...
  • Sectoid Dev 2012-11-21 12:46
    Ex-Dev:
    Apparently the sales clerk had received a pop-up window with the error message:

    "RAAAAAHH. BRAINS. MUST FEED."



    Sounds like a zombie process
  • Bananas 2012-11-21 12:56
    Ex-Dev:
    This reminds me of an error we had to troubleshoot about ten years ago while consulting for a customer in the transportation industry:

    Our support team received a ticket from an internal user of our reservation system. Apparently the sales clerk had received a pop-up window with the error message:

    "RAAAAAHH. BRAINS. MUST FEED."

    [snip]

    It would be interesting to know what set of special circumstances triggered this dormant joke and how long it had lain in waiting.
    Isn't it obvious? There was a zombie process.
  • Bananas 2012-11-21 12:58
    Bananas:
    Ex-Dev:
    This reminds me of an error we had to troubleshoot about ten years ago while consulting for a customer in the transportation industry:

    Our support team received a ticket from an internal user of our reservation system. Apparently the sales clerk had received a pop-up window with the error message:

    "RAAAAAHH. BRAINS. MUST FEED."

    [snip]

    It would be interesting to know what set of special circumstances triggered this dormant joke and how long it had lain in waiting.
    Isn't it obvious? There was a zombie process.
    And, my thunder is stolen by Sectoid Dev. That's what I get for reading all the comments before I post my own.
  • Poochy.EXE 2012-11-21 13:00
    Here's a Java one:
    Exception up = new Exception();
    
    throw up;
  • PT 2012-11-21 13:53

    private void CometWorker_OnFirstJoint(object sender, EventArgs e)
    {
    var timeStampArgs = e as TimeStampArgs;
    if (timeStampArgs.Value > 420)
    {
    RaiseMunchieEvent();
    }
    }
  • fa2k 2012-11-21 13:56
    Poochy.EXE:
    Here's a Java one:
    Exception up = new Exception();
    
    throw up;

    My favourite way to make a python program crash is to
    raise "hell"
    (to be fair, it's not valid python, but it does the job)
  • The Bytemaster 2012-11-21 14:04
    One of my earliest coding projects was for a place that put on group events. One of the options was for including Beer and Wine for the guests, at an additional price of course.

    There was a lot of logic that had to be handled internally and I was one for meaningful variable names. Also, intellisense was not as good back then, so I wanted to shorten BeerAndWine to something else... especailly in its various permiatations

    So I just called it Booze.

    I had a lot more fun with the project after adding in Booze.

    (It was an early project of mine in VB6. I wouldn't have a dozen or so fields, objects, flags, etc with BeerAndWine in the name these days, or would I need to do it the way I did. Very interesting integration with their accounting and contact management systems).
  • The Bytemaster 2012-11-21 14:18
    Then there was my other little project. I was actually the Helpdesk lead at the time, but we ended up with little LOB coding projects to help out the agency.

    They wanted a single icon for these utilities, which resulted in a launcher screen that went to the various modules. It had 3 buttons, so messing with them was not too much of an issue.

    On the launch I ran a routine called "CheckHoliday", which would change the colors of the dialog for each holiday... reds and pinks for valentines day. Shades of green for St Patrick's day etc.

    Then their was April 1st. I inverted the order of the text on the buttons. The icons were the same. It also added a message that said "Happy April Fools Day". The first time it generated a a few helpdesk calls, but no harm, no foul. The agency considered removing it, but it was too much fun and the few extra helpdesk calls helped practice good customer service.

    A few years after I, uh, was no longer with that agency, I heard it still did that.
  • WhiskeyJack 2012-11-21 15:51
    Jack:
    One day at the end of my shift I left my station saying:

    SYSTEM READY FOR COMBAT
    >

    The next day the supervisor reprimanded me. Just because I was taking computer classes didn't mean I could reprogram their system. She said the next shift was afraid to use that station and they lost productivity as a result. I showed her how much difficulty and technical acumen was required to "reprogram" the system. She was, still, not amused.


    You know this reminds me of when I was little. I found a book about Applesoft BASIC programming (guess my dad had picked it up somewhere when we got our Apple ][) when I was about 8 or 9 years old. (How old are you in 4th grade? 8 or 9 right?) We had computer lab time, which basically meant we all sat down in a room inside the library, filled with Apple ]['s, and we were supposed to play with LOGO. I took it upon myself to break into Apple DOS and write the following program:

    10 PRINT "I CAN BEEP!"
    20 PRINT CHR$(7)
    30 GOTO 10

    Then I proudly ran it. The teacher was not amused. She heard the commotion, walked over, saw what was printing on the screen, and said "Yes, I can see that. Now make it stop."

    I always thought she should have been far more impressed by the skills of a young programmer-in-the-making... oh well.
  • pencilcase 2012-11-21 15:53
    Ok, here's my egoic story. I once wrote an app in Powerbuilder, and attached a rather good Windows Help File, with context help and loads of good user documentation (I think). But then I had a boring afternoon, and wrote an FAQ section. Hidden in the depths, I put an entry "How do I: Make Potatoes Dauphinoises?", and put the recipe. 5 years later, I got a phone call from one of the support programmers, asking if that was me, as someone had finally bothered reading the help file and come across it. Well, we laughed for a short while, anyway.
  • neminem 2012-11-21 17:18
    Incidentally, I just remembered another comment I added to another legitimate emoticon in the code:
    filters.Split(';'); // this Kirby has an electric eel for a mouth!

    Wonder how long it'll take someone else to notice that comment... and whether they'll get the nethack reference.
  • foxyshadis 2012-11-21 17:43
    I've worked at a few places where the last comment makes perfect sense; the only time morale was above sea level was when someone was actively sabotaging the project to make their manager look bad. Leaving problems and kludges for future generations was par for the course, although the passive-aggressive comment really tops it off.
  • chubertdev 2012-11-21 17:51
    me_again:
    My favorites are checking isDirty on private members


    hehe
  • chubertdev 2012-11-21 17:51
    my personal favorite:

    // you know that point in a TV show when the doctor says, "I could lose my license for this?"
    // that best represents this code
  • Friedrice the Great 2012-11-21 18:16
    Poochy.EXE:
    Here's a Java one:
    Exception up = new Exception();
    
    throw up;


    I've always liked this name for a Chuck Norris Fan Club: UP CHUCK!
  • Staticsan 2012-11-21 18:56
    My favourite story was something a colleague did many years ago. And I get way more mileage out of it than he ever did.

    He wrote a custom print server for a branch network. Basically, two or three customer service terminals shared the one printer (printing didn't happen all that often). It was in VB and he was a little bored the day he was writing the error messages.

    One of the messages was "Orange Marmalade? No, Paper Jam!", for, yes, when the printer reported a jam. The support desk was more puzzled than amused the first time it came up. And apparantly my colleague had forgotten he'd written it. I'm pretty sure they left it in. The support desk was only really annoyed they hadn't know about it beforehand...
  • Norman Diamond 2012-11-21 20:43
    What about hilarious comments in HTML code? Has any reader of this site ever seen any?

    (By the way, I'm not complaining about hilarious comments in HTML code. Some of them are hilarious.)
  • Watson 2012-11-21 22:44
  • Tangaroa 2012-11-22 00:25
    While writing a PHP emailer, I learned that MIME separator strings did not need to mean anything, they just needed to be consistent within the same message, so I used a string along the lines of "---aybabtu-o-rly-ya-rly-no-wai" as an easter egg for anyone reading their mail raw. Someone else later rewrote the script, and they kept that in.

    Another time I was working on shapefile code and commented a certain line like this:

    int SHPD; // kwi


    If you follow Sluggy Freelance, this is *funny*. It probably confused the hell out of whoever was stuck with the code next, but I was young and inconsiderate.
  • Fecal Matter Lip Fur 2012-11-22 03:10
    I added a button to play humppa on a small program used at our plant because the GUI wasn't balanced otherwise. It's proven quite popular. (Both the program and the humppa.)
  • Polar Bear 2012-11-22 07:33
    I once saw a website with the following comment:

    <!-- *snipped* a bunch of JavaScript that Google told us to put in. Seemed pretty pointless and caused an error. We don't need no stinking JavaScript. -->
  • PaulR 2012-11-22 07:56
    The Apple //e's source code had a comment in the serial port's routine: "Something magical happens."

    I suspect that that routine gave Woz a bit of a hard time...
  • squigbobble 2012-11-22 08:54
    "//Don't expect much work to get done after this event is triggered
    CometWorker.OnFirstJoint += new FirstJointObjects(CometWorker_OnFirstJoint)"

    ...especially now that Comet, the electrical retailer, has gone bust.
  • Hatshepsut 2012-11-22 09:41
    The number of times I've seen embedded code in which the name of the routine to service the hardware watchdog contains the word 'bone'...

    Champagne comedy!

  • definitely not a robot 2012-11-22 19:07
    Well I'm Polish and I definitely get the Comet joke... sorry bro
  • Keyslo 2012-11-23 22:04
    Yep, something like - never can raise - kind of error with message 'Matrix is everywhere' at credit card online payment transaction confirmation page... What a fun my coleague had with his special message when customer got it...
  • iToad 2012-11-26 10:14
    Damn... I clicked on one of the links and got Rickrolled.
  • Spewin Coffee 2012-11-26 14:18
    WhiskeyJack:
    Jack:
    One day at the end of my shift I left my station saying:

    SYSTEM READY FOR COMBAT
    >

    The next day the supervisor reprimanded me. Just because I was taking computer classes didn't mean I could reprogram their system. She said the next shift was afraid to use that station and they lost productivity as a result. I showed her how much difficulty and technical acumen was required to "reprogram" the system. She was, still, not amused.


    You know this reminds me of when I was little. I found a book about Applesoft BASIC programming (guess my dad had picked it up somewhere when we got our Apple ][) when I was about 8 or 9 years old. (How old are you in 4th grade? 8 or 9 right?) We had computer lab time, which basically meant we all sat down in a room inside the library, filled with Apple ]['s, and we were supposed to play with LOGO. I took it upon myself to break into Apple DOS and write the following program:

    10 PRINT "I CAN BEEP!"
    20 PRINT CHR$(7)
    30 GOTO 10

    Then I proudly ran it. The teacher was not amused. She heard the commotion, walked over, saw what was printing on the screen, and said "Yes, I can see that. Now make it stop."

    I always thought she should have been far more impressed by the skills of a young programmer-in-the-making... oh well.


    I find it more interesting that teachers frowned upon such things not understanding the significance that people who start programming at a young age have a more significant future ahead of them than most other students of those same years. I have similar memories of attempted suppression. For example, when we got those Texas Instruments programmable graphing calculators in school, mine was constantly being taken away because I couldn't possibly be paying attention. I had my nose buried in it whenever it wasn't taken away and was writing code and still got solid A's in all my classes (usually 95 or higher, rarely an A- and maybe one B+). Most teachers gave up.
  • j 2012-11-27 20:02
    I sometimes add

    // unsung namespace some_ns;

    as a friendly reminder. Mellow is the name of the game.
  • santobugito 2012-11-30 11:43
    There is also a Cockney filter in the code as well which alters words to cockney representations.
  • Somedude 2012-12-21 13:18
    We had an application that created batch files for banks. We had to create one file for each of our merchants, and send them to the bank.

    Got a new bank, and we could send them all the merchant's transactions in a single batch file, so I set about building this new multiple batch capability.

    It was a hairy project, the whole multi batch thing turned out to be fairly complex. But, I finally got it done, and it worked great.

    After my boss, and pretty much everyone going on and on about the multi batch for weeks, I felt there was no choice. I named the key file of the whole thing... LeelooDallasMultiBatch.