• (cs)

    so there is no "true" or "false" in M$ land?

  • (cs) in reply to Mung Kee

    That's not C#, I'm pretty sure it's java.

  • (cs)

    That's not just a WFT, it's also an OMG.  How do these people idiots get jobs?


  • (cs) in reply to Ytram
    Ytram:
    That's not C#, I'm pretty sure it's java.


    You are correct sir
  • Patrick (unregistered)

    No way.  That can't be real.

    No way.

  • (cs)

    Ok, somebody's just making this shit up now.  No way does that really exist in a production system somewhere.

  • Sean Connery (unregistered) in reply to Patrick
    Anonymous:
    No way.  That can't be real.

    No way.

    Even if its real, it must be a joke. Trying to get into the daily wtf.
  • (cs)

    If a million monkeys got a million programming jobs, the first one to log in would write this.

  • jvm (unregistered) in reply to Sean Connery

    How do these people idiots get jobs?
    I bet he's fat.

  • Matt (unregistered) in reply to Patrick

    That kind of idiocy just can't be explained. HOW HARD IS THIS:

    boolObj.booleanValue();

  • (cs)

    <FONT style="BACKGROUND-COLOR: #ffffff" color=#ff0000>SHENANIGANS!</FONT>

  • (cs) in reply to jvm

    Pat, I'd like to buy a not operator ("!")

  • (cs)

    ROFLMAO

    Not only is it ugly, it's WRONG!

    checkFalse(true) is: true
    checkFalse(false) is: false

    Transcription error?

  • Daniel T (unregistered) in reply to Sean Connery
    Anonymous:
    Anonymous:
    No way.  That can't be real.

    No way.

    Even if its real, it must be a joke. Trying to get into the daily wtf.


    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.
  • (cs) in reply to El Duderino

    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!

  • (cs) in reply to Maurits
    Maurits:
    ROFLMAO

    Not only is it ugly, it's WRONG!

    checkFalse(true) is: true
    checkFalse(false) is: false

    Transcription error?


    Just noticed that myself....LOL, and yeah its definitely not C# they use "bool" instead of "Boolean"
  • (cs)

    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.

  • (cs)

    This is worthless.  It doesn't handle Boolean.MAYBE objects!

  • Jake Heidt (unregistered)

    OH....

    MY....

    GOD.

     

    [:'(][:'(][:'(][:'(]

  • Robin Lavall&#233;e (unregistered) in reply to Maurits

    Why not just rename the function to "identity". ?

  • (cs) in reply to Ytram
    Ytram:
    That's not C#, I'm pretty sure it's java.


    You are correct!  It's Java.  And this developer moron abused is so many ways, it makes my head hurt.
  • (cs) in reply to richleick
    richleick:
    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.


    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.

    richleick:

    Then again, maybe this is just plain crap.


    Yes, I think you hit the nail on the head.

  • (cs)

    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.

  • jb (unregistered)

    and when bool is null, you get a nice NullPointerException

  • (cs) in reply to richleick

    richleick:
    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.

    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>

  • (cs) in reply to El Duderino

    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.

  • (cs) in reply to Ytram
    Ytram:
    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.


    Thanks, my cent a mints exactly
  • SkittlesAreYum (unregistered) in reply to richleick
    richleick:
    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.


    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.
  • (cs) in reply to travisowens
    travisowens:
    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.


    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.


  • (cs) in reply to SkittlesAreYum
    Anonymous:
    richleick:
    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.


    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.


    The biggest WTF today is all the people wanting to fight about wording.
  • (cs) in reply to Maurits

    Maurits:

    Transcription error?

    Today's code is actually verbatim. I saw no point in anonymozing this ;-)

  • (cs) in reply to Maurits

    <font size="2">

    Maurits:
    ROFLMAO

    Not only is it ugly, it's WRONG!

    checkFalse(true) is: true

    checkFalse(false) is: false

    Transcription error?


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

    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
        }

  • (cs)

    I just have Samir's (from Officespace) voice going through my head: "You are a very bad person..."

    Can't say it better myself.

  • (cs) in reply to travisowens
    travisowens:

    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.



    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:


    if (somethingsomething)


    ...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.

  • Code6 (unregistered) in reply to DelawareBoy

    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.

  • (cs) in reply to Code6

    this is bad , but not as bad as the

     #define INTEGER_VALUE_ONE 1

    one that there was a while back.

  • (cs) in reply to loneprogrammer

    loneprogrammer:
    This is worthless.  It doesn't handle Boolean.MAYBE objects!

    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] [:|] [:'(]

  • (cs)

    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).

  • (cs)

    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.

  • Hank Miller (unregistered)

    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)
  • (cs) in reply to petvirus
    petvirus:
    There was also some really REALLY big chunks of code to do what parseInt() does and such.


    Now that would be a gem
  • Smokey (unregistered)

    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!

    [|-)]

  • raolin (unregistered) in reply to WTFer

    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. 

  • (cs)

    rotfl That one's really funny.

  • (cs) in reply to jvm
    Anonymous:
    How do these people idiots get jobs?
    I bet he's fat.


    Now, now. There are stupid thin people too. Stop it now, before NAAFA gets you.

    travisowens:

    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. 


    To hinder it?


  • (cs)

    I've just lost my breakfast...

  • sabatick (unregistered) in reply to Robin Lavall&#233;e
    Anonymous:
    Why not just rename the function to "identity". ?

    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.


  • (cs) in reply to sabatick
    Anonymous:
    Anonymous:
    Why not just rename the function to "identity". ?

    Because it would be a lot of work to handle all kinds of objects which you want to work identity on.


    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.
  • (cs) in reply to raolin
    Anonymous:
    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. 


    if(fish)
      throw NoFish;
    elseif (recurse == pangalacticgargleblaster)
      throw BlowYerStack;
    else
      assert("Hi.");

Leave a comment on “A False Detector”

Log In or post as a guest

Replying to comment #:

« Return to Article