And stuff similar to this subject. I like to hear dumb people stories.
Look at other people's code, see this.
public static int makePositive(int num) {
if(num < 0) {
int pos = num-num-num;
return pos;
} else {
return num;
}
}
Name:
Anonymous2013-02-20 21:40
(Commercial programmer here, working for large IT company)
Worst I've seen was some Java code in a printing-related class which defined two separate "rounding" functions. Each function used a bunch of ifs, type casts, and String formatting methods. They turned out to be exactly equivalent to (int) Math.floor(x) and (int) Math.ceil(x). But probably 50 times slower.
Second worst, an intern once added a new field to one of the main UI components of our application. It was a boolean field called simply theBool. Had something to do with animation and went through some fairly complex state changes, but I never managed to figure out exactly what it did. theBool. Thankfully the project died soon after.