- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
so there is no "true" or "false" in M$ land?
Admin
That's not C#, I'm pretty sure it's java.
Admin
That's not just a WFT, it's also an OMG. How do these people idiots get jobs?
Admin
You are correct sir
Admin
No way. That can't be real.
No way.
Admin
Ok, somebody's just making this shit up now. No way does that really exist in a production system somewhere.
Admin
Even if its real, it must be a joke. Trying to get into the daily wtf.
Admin
If a million monkeys got a million programming jobs, the first one to log in would write this.
Admin
How do these people idiots get jobs?
I bet he's fat.
Admin
That kind of idiocy just can't be explained. HOW HARD IS THIS:
boolObj.booleanValue();
Admin
<FONT style="BACKGROUND-COLOR: #ffffff" color=#ff0000>SHENANIGANS!</FONT>
Admin
Pat, I'd like to buy a not operator ("!")
Admin
ROFLMAO
Not only is it ugly, it's WRONG!
checkFalse(true) is: true
checkFalse(false) is: false
Transcription error?
Admin
The ONLY way this is real is that someone used some sort of code generator that somehow spit out this monstrosity.
There was a WTF a few weeks ago with something almost as bad with Integer/int.
Admin
The WTF is that if I saw a method called CheckFalse() I would expect it to return TRUE given a FALSE input. This idiot broke the semantic logic!
Admin
Just noticed that myself....LOL, and yeah its definitely not C# they use "bool" instead of "Boolean"
Admin
Ok, in no way am I trying to justify this, but the one thing that comes to mind is that this was written for casting and/or type compliance. You see, Java, in its attempt to be OO compliant has an int data type and Integer data type. The Integer is an actual class that has all sorts of functions. Including something like Integer.intValue(). So this was probably written because they needed to use the bool type instead of the Boolean type. Maybe they were using a 3rd party module or something.
Then again, maybe this is just plain crap.
Admin
This is worthless. It doesn't handle Boolean.MAYBE objects!
Admin
OH....
MY....
GOD.
[:'(][:'(][:'(][:'(]
Admin
Why not just rename the function to "identity". ?
Admin
You are correct! It's Java. And this developer moron abused is so many ways, it makes my head hurt.
Admin
Okay, I've been doing java for a while now, and I still have not come across the bool type. Could you please tell all of us what that is?
Java does in fact have a primitive boolean, and the wrapper Boolean, just like int and Integer.
Yes, I think you hit the nail on the head.
Admin
While I will admit this code is slightly wierd, I will defend the reasoning behind it. I can tell you now this was done purely for human legibility of code. While I haven't done something this simple of a check, I've often created methods soley for the reason of more readable code.
But I have created super simple methods such as <FONT face="Courier New">IsNullOrEmpty()</FONT> because calling this like <FONT face="Courier New">if (IsNullOrEmpty(x))</FONT> is much more readable than <FONT face="Courier New">if (x == null or x == "")</FONT>
But I think somebody took this concept way to far because he already has a boolean to check against.
I try to make my code as english readable as possibly, call it dumbing it down, but even a non coder can understand the basics of my OOP code.
Admin
and when bool is null, you get a nice NullPointerException
Admin
My Java knowledge is limited but even I can tell that the bool in the code is the parameter name; all of the other references are to Boolean. So I think your alternate hypothesis must be <FONT face="Courier New" size=2>this.checkFalse(TRUE).</FONT>
Admin
C'mon guys, you all know what richleickis referring to. He said bool, but he really meant boolean. As in the primitive data type. Don't let typos/semantics/etc. get in the way of what really matters: How crappy the code is in this WTF.
Admin
Thanks, my cent a mints exactly
Admin
There is no bool type. There's boolean (primitive) and Boolean (wrapper). If he wants the primitive value, all he has to do is call booleanValue() on the wrapper.
So, in relation to the code posted, instead of that function they would just have to do bool.booleanValue(), and it would return the exact same thing as their function.
Admin
How readable is this to the average simian, assuming there is an "if" somewhere calling this?
if(!bool.booleanValue()){
}
I guess with yuor approach, the CFO and the VP of Marketing will know exactly what's going on in the code.
Admin
The biggest WTF today is all the people wanting to fight about wording.
Admin
Today's code is actually verbatim. I saw no point in anonymozing this ;-)
Admin
<font size="2">
How do you know it's wrong? If the function was named isFalse() instead of checkFalse(), then it would sure seem wrong.
As it is, the semantics of check aren't clear (another WTF).
</font>
Admin
how code looks to a real coder:
if (booleanValue){
//complete task
}
how code looks to newbs:
if (booleanValue == true) {
//complete task
}
how code looks to the moron/crack addict who wrote the WTF code
function boolean figureBoolean( boolean bool) {
if( (booleanValue == true) && true) {
return true;
else if( (booleanValue == false) && !false) {
return false;
} else
return figureBoolean( (rand() % 2) == 1);
}
if (figureBoolean (myBoolValue == true)) {
//complete task
}
Admin
I just have Samir's (from Officespace) voice going through my head: "You are a very bad person..."
Can't say it better myself.
Admin
Barely, sir, barely.
Certainly not worth the extra cycles for the function call and execution (no matter how light), as well as the dependency on the library that contains these check-functions.
this:
...reads just fine to anyone with a 10-minute crash course in the basics of any language.
I'm curious, why do you cater to non-coders? Why are non-coders looking at your code?
PS.
In your defense, we have an isEmpty() function in our library, to check for "", 0, null and false, because you're right that putting those four compares in the if() doesn't help readability.
I never use it.
Admin
Wow, I was sure I'd seen some dumb stuff, but that... What kind of code do these type of morons come up with when they are actually faced with a "complex" problem to solve?
What I want to see is how this particular asshat handles enums! If it took that much code to figure out a true/false statement, I can't wait to see what else this guy could come up with. And an enum is trivially simple. I want to see this cat go after some threading or something that is seriously above his mental capacity. lol.
Things like this just remind me that there really are some people I could piss on mentally.
Admin
this is bad , but not as bad as the
#define INTEGER_VALUE_ONE 1
one that there was a while back.
Admin
No, the whole point of this code seems to be to avoid that pitfall. Note the catch-all else. If it is Boolean.FALSE, the method returns Boolean.FALSE.booleanValue(). For all other values: Boolean.MAYBE, Boolean.SOMETIMES, Boolean.IF_THE_WIND_IS_IN_THE_WEST the function returns Boolean.TRUE.
Obviously this is a programmer who has to work with people of produce Boolean.MAYBE values, and he wants to put a stop to it
This code does that brilliantly [8-)] [:S] [:|] [:'(]
Admin
I must admit I did once:
if(boolValue == true){
...
}
during my college years. Yes, I am ashamed. Don't look at me, I am hedious. (But this guy is much worse).
Admin
I must say, i found this code, its real, it was in a system i recently started working on. There was other WTFs in the system, but nothing as bad as this.
There was also some really REALLY big chunks of code to do what parseInt() does and such.
Admin
It isn't often that code makes be burst out laughing, but this managed to do that.
Forget the OMG, this code jsut doesn't have the lenght for that. (though it comes close)
It isn't a case of paid by LOC, though that is perhaps the most logical explination.
It isn't a WTF, If it was I wouldn't comprehend the whole thing in seconds like I could for this. Most of the code seen here takes me a little time to comprehend.
No, this is just a burst out laughing right in my cube function.
At least it is readable. Not as readable is if(foo), but it is readable. (though as other noted it returns the wrong value)
Admin
Now that would be a gem
Admin
C'mon anybody could guess that this just makes the following code all that much easier!
new FalseChecker().checkFalse( new Boolean( Boolean.FALSE.booleanValue())) ? <FONT color=#ff1493>true</FONT> : <FONT color=#ff1493>false</FONT>;
Geez, use some creativity!
[|-)]
Admin
While that is inelegant, there have been times when I was maintaining code that had very, very poorly named variables and doing the explicit (boolValue == true) was the only way to make the code the least bit intuitive.
Admin
rotfl That one's really funny.
Admin
Now, now. There are stupid thin people too. Stop it now, before NAAFA gets you.
To hinder it?
Admin
I've just lost my breakfast...
Admin
Because it would be a lot of work to handle all kinds of objects which you want to work identity on.
Just consider how hard it would be to write idenity for objects which refuse to be cloned.
Not to mention the problems due to the lack of multimethods in Java.
I thinks that guy did a good job at pointing out how much fun programming is.
Admin
Whatchoo talkin' bout, Willis?
public Object identity(Object obj)
{ return obj;
}
If you want to handle Java's native types too, go ahead... or just require the caller Boolean-ify his booleans, etc. I forget how many non-Object native types there are in Java, but it's certainly less than ten.
Admin
if(fish)
throw NoFish;
elseif (recurse == pangalacticgargleblaster)
throw BlowYerStack;
else
assert("Hi.");