|
This is going back many years, and from memory it went something like this:
- (bool)is_even(int value)
{
if (value == 0)
{
return true;
}
else if (value == 2)
{
return true;
}
else if (value == 4)
{
return true;
}
...
else if (value == 12)
{
return true;
}
return false;
}
And so it went to 12 and I guess for the context in which it was used it apparently was a high enough number. You could of course replace this method using a simple modulus operation.
What's also funny is that I saw this code in a printout on the wall of an engineer, which had been there for a couple years. A short time after, another engineer, new to the group, found this method still existing in another part of the code base (apparently just copy-pasted from its original location). The code base was very large.
Lesson learned is if you find bad code somewhere do a global search to insure it is not duplicated anywhere else.
|
|
|
|
|
Haha I am sure i have read this in a book or programming tutorial as an example for bad code.
|
|
|
|
|
private bool IsEven(int number) {
return (new[] { 0, 2, 4, 6, 8 }).Contains(number.ToString()[number.ToString().Length - 1]);
}
|
|
|
|
|
this following jQuery nugget:
if ( $('#'+src.id).parent().parent().next().children().children('.dvSpeakerBio').is(":visible") )
{
$('#'+src.id).parent().parent().next().hide();
$('#'+src.id).parent().parent().next().children().children('.dvSpeakerBio').hide();
$('.speaker').removeClass('selectedSpeaker');
$('.alt_speaker').css('background-color', '#f6f6f6');
}
|
|
|
|
|
For me, it was a WinForms app written in VB.NET that was using hidden Textbox controls on the form as a Boolean variable!!! The whole app was full with checks for true/false against a Textbox.Text property instead of simply declaring a boolean variable.
|
|
|
|
|
That one just is.... blech. Was this... programmer (I use the term loosely here)... a new guy? Or someone who knew nothing about what they were working with (e.g. PEBKAC o ID-Ten-T)?
I think computer viruses should count as life. I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image.
Stephen Hawking
|
|
|
|
|
It gets better: This app was handed to me, so I can fix all kinds of weird and non-consistent errors that were happening all the time. The vb app was created by a contractor ($100/hr) who converted it from a Microsoft Access database that was developed by another consultant over a span of a year and a half for which she was paid in excess of $200k. Until this day, I cannot believe what I saw and comprehend how a consultant can get paid that much money for creating an Access database using textboxes as boolean variables and for another contractor to convert the code and not realize the insanity of that code either. And there was me, making just little over $50k at the time...disgusting isn't it
|
|
|
|
|
Well, that goes to show what non-programmers think: "If I cannot read it, it must be the best thing out there!"
And that contractor was an ID-Ten-T that had a NullBrainException coupled with a IncompetentProgrammerException and a OverpaidPersonException .
I think computer viruses should count as life. I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image.
Stephen Hawking
|
|
|
|
|
Don't know if my most interesting/funny/silly but some of the last I found.
Comments should help to better understand ... maybe!
if (anyBooleanValue == false)
{
...
}
else
{
...
}
...
return;
Twice are better ...
DataTable dt = new DataTable();
dt = otherTable.Copy();
|
|
|
|
|
I once had to work on a package (in an 3G language/database called Dataflex if anyone remembers it) that contained the following remarkd
The following is Himalayan Mountain Climber code, and so is impenetrable to us mere mortals!
When I asked what this meant, I was told that it had been written by a contractor, whose hobby was indeed climbing in the Himalayas, who was known for using all sorts of undocumented tricks to provide very clever and efficient code that nobody else could understand.
====================================
Transvestites - Roberts in Disguise!
====================================
|
|
|
|
|
Browsing around the web (While working ) I found this beautiful page which gives an overview of the most creepy and crappy web pages. So what on earth made the webmasters putting such creepy stuff up to a web server (they wasted a lot of space, IMO)?
Find the creepiest pages of the web[^]
Note: I am not responsible for any eye cancers or serious health problems you may get after viewing the link
|
|
|
|
|
Idd Jeezus came to mind. Ah my eyes .
|
|
|
|
|
Haiti News Network is the most pathetic, real innovative work
|
|
|
|
|
They bring up the most earth-shaking new, I suppose
|
|
|
|
|
This site (which I have to use on occasion) uses Flash in the tab controls (be sure you have your volume turned up for this). The best I can tell, it's the only use of Flash on the site. So someone thought "this site is dull without little clicky noises; let's use Flash!" during development? I'm sure there are worse examples (open invite for examples), but this is simply overkill at best. Also, I have no idea why it's ftp, but whatever.
ftp://ftp.relius.net/Administration/quantech/RA170/RA170News/Default.htm[^]
|
|
|
|
|
My favorite part is how the tabs are stacked.
I cannot imagine putting all that work into a sound effect and then leaving it visually ugly.
|
|
|
|
|
And sluggish. Don't forget it's a sluggardly site as well.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
Someone learned to play with a new toy and figured they would just have to use it on the next project.
It's moments like this that make me wish we had a double face-palm emoticon.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
This document and the software it describes may not be reproduced, in whole or in part, in any form whatsoever without the written permission of SunGard.
I reproduced a part of the website on my screen, using a browser, by clicking the link.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
The FBI will be visiting you this afternoon.
|
|
|
|
|
|
Hi there, the link is broken ( could they be embarrassed ? )
|
|
|
|
|
Weird... It seems to be working for me as of right now.
|
|
|
|
|
Still down for me , get a 404 error - weird !!
|
|
|
|
|
+5 for the use of the word 'Egregious'!
I think computer viruses should count as life. I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image.
Stephen Hawking
|
|
|
|