Comment On Code Comedians

When it comes to bad code, everybody thinks they’re a comedian. Heck, look at us! Stupid programmer jokes are a game everyone can play, though, so let’s enjoy an evening at the Improv with some code comedians. [expand full text]
« PrevPage 1 | Page 2Next »

Re: Code Comedians

2012-11-21 08:05 • by wraith
I remember a comment I once wrote myself.

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

Re: Code Comedians

2012-11-21 08:13 • by Nappy (unregistered)
[DontTazeMeBro]
Probably part of the Share the pain program
http://www.metacafe.com/watch/88657/share_the_pain/

Re: Code Comedians

2012-11-21 08:15 • by 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! */

Re: Code Comedians

2012-11-21 08:20 • by Remy Porter
395339 in reply to 395337
DIIIIIIIIIVVVVVVVVEEEEEEEEEEEEE.

Man, BRIAN BLESSED makes everything better.

Re: Code Comedians

2012-11-21 08:24 • by Warren (unregistered)
Perhaps CometWorkers.OnFirstJoint has been triggered too much, leading to Comet's - major UK electrical chain's - recent demise.

Re: Code Comedians

2012-11-21 08:25 • by LoremIpsumDolorSitAmet
//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.

Re: Code Comedians

2012-11-21 08:25 • by Warren (unregistered)
395342 in reply to 395340
Perhaps CometWorkers.OnFirstJoint has been triggered too much, leading to Comet's - major UK electrical chain's - recent demise.

Re: Code Comedians

2012-11-21 08:25 • by PK (unregistered)
One of the best I have seen was:
"Oh magic numbers, guide us to the light!"

Re: Code Comedians

2012-11-21 08:30 • by Smug Unix User (unregistered)
Sadly source control and peer reviews remove most of the funny comments or clever variable names.

marypoppins = (superman + starship) / god;

Re: Code Comedians

2012-11-21 08:31 • by PedanticCurmudgeon
395345 in reply to 395342
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.

Re: Code Comedians

2012-11-21 08:40 • by Cbuttius
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.

Re: Code Comedians

2012-11-21 08:40 • by n9ds
"Brian claims that [DontTazeMeBro] is never returned . . "

Sounds like another episode of "Famous Last Words"

Re: Code Comedians

2012-11-21 08:44 • by Remy Porter
395349 in reply to 395347
Hunh. I thought I had made it a CodeSOD. One too many triggers of OnFirstJoint, apparently.

Re: Code Comedians

2012-11-21 08:44 • by 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.

Re: Code Comedians

2012-11-21 08:48 • by Mark Bowytz
395351 in reply to 395349
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.

Re: Code Comedians

2012-11-21 08:54 • by ¯\(°_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.

Re: Code Comedians

2012-11-21 08:58 • by ZPedro
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.

Re: Code Comedians

2012-11-21 09:08 • by 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.

Re: Code Comedians

2012-11-21 09:12 • by KattMan
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.

Re: Code Comedians

2012-11-21 09:38 • by Anom (unregistered)
395359 in reply to 395337
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 ˆ

Re: Code Comedians

2012-11-21 09:40 • by 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.

Re: Code Comedians

2012-11-21 09:41 • by me_again (unregistered)
My favorites are checking isDirty on private members

Re: Code Comedians

2012-11-21 09:50 • by just stop it (unregistered)
395363 in reply to 395350
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.

Re: Code Comedians

2012-11-21 09:53 • by @Deprecated
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"

Re: Code Comedians

2012-11-21 10:05 • by theunknownsleeper (unregistered)
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

Re: Code Comedians

2012-11-21 10:15 • by 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.

Re: Code Comedians

2012-11-21 10:19 • by 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.

Re: Code Comedians

2012-11-21 10:30 • by d (unregistered)
I remember reading my old code, and a particularly ugly hack was commented:

"Forgive me future David."

Re: Code Comedians

2012-11-21 10:31 • by dbomb123
So, I shouldn't name all references to objects with a 'transform' method after autobots?

Re: Code Comedians

2012-11-21 10:33 • by 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

Re: Code Comedians

2012-11-21 10:50 • by 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
}

Re: Code Comedians

2012-11-21 11:03 • by Evo
395379 in reply to 395377
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.

Re: Code Comedians

2012-11-21 11:05 • by KattMan
395380 in reply to 395379
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.

Re: Code Comedians

2012-11-21 11:46 • by BOFH (unregistered)
395382 in reply to 395358
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.

Re: Code Comedians

2012-11-21 12:00 • by 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.

Re: Code Comedians

2012-11-21 12:29 • by 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?

Re: Code Comedians

2012-11-21 12:44 • by asd (unregistered)
$months = array('Nullember', 'January', 'February' , ...

Re: Code Comedians

2012-11-21 12:46 • by Sectoid Dev (unregistered)
395389 in reply to 395367
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

Re: Code Comedians

2012-11-21 12:56 • by Bananas (unregistered)
395390 in reply to 395367
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.

Re: Code Comedians

2012-11-21 12:58 • by Bananas (unregistered)
395391 in reply to 395390
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.

Re: Code Comedians

2012-11-21 13:00 • by Poochy.EXE
Here's a Java one:
Exception up = new Exception();

throw up;

Re: Code Comedians

2012-11-21 13:53 • by PT (unregistered)

private void CometWorker_OnFirstJoint(object sender, EventArgs e)
{
var timeStampArgs = e as TimeStampArgs;
if (timeStampArgs.Value > 420)
{
RaiseMunchieEvent();
}
}

Re: Code Comedians

2012-11-21 13:56 • by fa2k (unregistered)
395394 in reply to 395392
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)

Re: Code Comedians

2012-11-21 14:04 • by The Bytemaster
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).

Re: Code Comedians

2012-11-21 14:18 • by The Bytemaster
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.

Re: Code Comedians

2012-11-21 15:51 • by WhiskeyJack
395397 in reply to 395384
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.

Re: Code Comedians

2012-11-21 15:53 • by 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.

Re: Code Comedians

2012-11-21 17:18 • by 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.

Re: Code Comedians

2012-11-21 17:43 • by 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.

Re: Code Comedians

2012-11-21 17:51 • by chubertdev
395401 in reply to 395361
me_again:
My favorites are checking isDirty on private members


hehe
« PrevPage 1 | Page 2Next »

Add Comment