• wraith (cs)

    I remember a comment I once wrote myself.

    // setting sibling0 as the parent of all other siblings (incest)

  • Nappy (unregistered)

    [DontTazeMeBro] Probably part of the Share the pain program http://www.metacafe.com/watch/88657/share_the_pain/

  • Arkady (unregistered)

    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 (cs) in reply to Arkady

    DIIIIIIIIIVVVVVVVVEEEEEEEEEEEEE.

    Man, BRIAN BLESSED makes everything better.

  • Warren (unregistered)

    Perhaps CometWorkers.OnFirstJoint has been triggered too much, leading to Comet's - major UK electrical chain's - recent demise.

  • LoremIpsumDolorSitAmet (cs)
    //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 (unregistered) in reply to Warren

    Perhaps CometWorkers.OnFirstJoint has been triggered too much, leading to Comet's - major UK electrical chain's - recent demise.

  • PK (unregistered)

    One of the best I have seen was: "Oh magic numbers, guide us to the light!"

  • Smug Unix User (unregistered)

    Sadly source control and peer reviews remove most of the funny comments or clever variable names.

    marypoppins = (superman + starship) / god;

  • PedanticCurmudgeon (cs) in reply to Warren
    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 (cs)

    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 (cs)

    "Brian claims that [DontTazeMeBro] is never returned . . "

    Sounds like another episode of "Famous Last Words"

  • Remy Porter (cs) in reply to Cbuttius

    Hunh. I thought I had made it a CodeSOD. One too many triggers of OnFirstJoint, apparently.

  • Simon Peyote Joints (unregistered)

    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 (cs) in reply to Remy Porter

    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 (unregistered)

    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 (cs)

    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? (unregistered)

    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 (cs)

    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 (unregistered) in reply to Arkady
    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 (unregistered)

    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 (unregistered)

    My favorites are checking isDirty on private members

  • just stop it (unregistered) in reply to Simon Peyote Joints
    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 (cs)

    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 (unregistered)

    WordPress uses the variable $pee to represent

    in the markup. Found this little gem in the codebase:

    $pee = preg_replace('!

    \s*(</?' . $allblocks . '[^>]>)\s

    !', "$1", $pee); // don't pee all over a tag

  • Ex-Dev (unregistered)

    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 (unregistered)

    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 (unregistered)

    I remember reading my old code, and a particularly ugly hack was commented:

    "Forgive me future David."

  • dbomb123 (cs)

    So, I shouldn't name all references to objects with a 'transform' method after autobots?

  • AGray (unregistered)
    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 (unregistered)

    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 (cs) in reply to neminem
    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 (cs) in reply to Evo
    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 (unregistered) in reply to KattMan
    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 (unregistered)

    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 (unregistered)

    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 (unregistered)

    $months = array('Nullember', 'January', 'February' , ...

  • Sectoid Dev (unregistered) in reply to Ex-Dev
    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 (unregistered) in reply to Ex-Dev
    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 (unregistered) in reply to Bananas
    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 (cs)

    Here's a Java one:

    Exception up = new Exception();
    throw up;
  • PT (unregistered)
    private void CometWorker_OnFirstJoint(object sender, EventArgs e)
    { 
      var timeStampArgs = e as TimeStampArgs;
      if (timeStampArgs.Value > 420) 
      {
        RaiseMunchieEvent();
      }
    }
    
  • fa2k (unregistered) in reply to Poochy.EXE
    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 (cs)

    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 (cs)

    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 (cs) in reply to Jack
    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 (unregistered)

    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 (unregistered)

    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 (unregistered)

    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 (cs) in reply to me_again
    me_again:
    My favorites are checking isDirty on private members

    hehe

Leave a comment on “Code Comedians”

Log In or post as a guest

Replying to comment #:

« Return to Article