• paolo (unregistered)

    first

  • Tony M (unregistered)

    Booleans are hard!

  • Cyan (unregistered)

    <font size="2">Because you never know when TRUE might equal FALSE...

    Hope be with ye,
    Cyan
    </font>

  • Colin (unregistered)

    Pshh, that doesn't even do tribool.  What crap.

  • Mr Beeper (unregistered)

    An excellent example of defensive programming.  You'll all be sorry you mocked it when the next version of the CLR adds "maybe" and "sometimes" to the list of possible values for a bool.

    Fools!

  • Justin (unregistered)

    Let's see.... true, false, maybe, possibly, should-be .... there must be a thousand other cases that we could test for ... maybe the language spec for a primitive will change -- who knows.

  • Justin (unregistered) in reply to Mr Beeper
    Anonymous:

    An excellent example of defensive programming.  You'll all be sorry you mocked it when the next version of the CLR adds "maybe" and "sometimes" to the list of possible values for a bool.

    Fools!

     

    You beat me to it!

  • naterkane (unregistered)

    if a boolean isn't true or false, then we have some bigger issues to address, no?

  • (cs)

    Wow, think of all the lines of code that could be used to validate that an integer is an integer.  Or testing every possible string combination.  That's like infinity billion lines!

  • (cs)

    Hmm...this quality of this WTF just isn't up to snuff.  C'mon Alex, give us some good ones!

  • naterkane (unregistered) in reply to Justin
    Anonymous:

    Let's see.... true, false, maybe, possibly, should-be .... there must be a thousand other cases that we could test for ... maybe the language spec for a primitive will change -- who knows.


    well, if you don't should on me, i won't should on you.
  • codeman (unregistered) in reply to Jake Vinson

    What about "File Not Found" ?

  • Jason (unregistered) in reply to Tony M

    Anonymous:
    Booleans are hard!

    No ... Booleans are! or Booleans not are! there is no hard!

  • (cs) in reply to codeman
    Anonymous:
    What about "File Not Found" ?

    God!  That took 13 minutes people!  We're slipping!
  • (cs)

    Should have been "throw new EndOfUniverseException();"

    If you are going to write code that is never going to get executed, it should at least be creative or something...yuck.

  • Anon (unregistered)

    The Daily WTF zings Slashdot; Slashdot takes a shot at Digg.  What's next? Digg attacks Fark?

  • Jogi (unregistered)

    Validating booleans is scrap, but converting them to strings to validate then (to two different strings each, because of the the uppercase conversion) is even worse.

  • Quietust (unregistered)

    The fun part comes when Boolean.ToString() is localized to return true/false strings in the appropriate language, at which point m_ISO9001.ToString().ToUpper() returns "VRAI"/"FAUX" on a computer in France and the program dies horribly.

  • APAQ11 (unregistered) in reply to Quietust

        bool v_ISO9001 = value;
        //can only be true or false
        if (v_ISO9001.ToString().ToUpper() == "TRUE" ||
            v_ISO9001.ToString().ToUpper() == "FALSE") { m_ISO9001 = v_ISO9001; } else
        {
          throw new ArgumentException();
        }

    Wouldn't the [bool v_ISO9001 = value;] part throw an exception if  value couldn't be made into a bool type anyways thus making the rest of this code pointless?

  • (cs) in reply to codeman
    Anonymous:
    What about "File Not Found" ?


    They lost it.
  • Justin (unregistered) in reply to Quietust

    Anonymous:
    The fun part comes when Boolean.ToString() is localized to return true/false strings in the appropriate language, at which point m_ISO9001.ToString().ToUpper() returns "VRAI"/"FAUX" on a computer in France and the program dies horribly.

     

    AH! so the whole point was to make sure that only ENGLISH speaking people can use the software!  Very creative security, and curse the french!

  • someone (unregistered) in reply to paolo
    Anonymous:
    first


    Dumb

    This guys ip should be banned

    Is this a first form or the daly wtf form?
  • Terry (unregistered) in reply to Jason

    But at least this code will catch it if someone tries to pass "hard" instead of "TRUE" or "FALSE"

    God, this guys a genious!  I wanna be like him when I grow up!

    BTW, does anyone else have trouble with the CAPTCHA?  I'm colour blind, and most of the time all I see is a pink block :S

  • (cs)

    Without bashing the developer, I would really want to know why the developer really felt it was important to go this route. Absolutely, this is "wtf-code", but, someone actually sat down to think this out - I would have to ask myself "why didnt they see the circular logic in using a Bool, casting to a String, and checking the string result in a boolean fashion?"

    Something is critically wrong when a developer, who obviously understands the OO principles of Get/Set and constructs of IF..THEN..ELSE plus Casting, yet, writes total bunk like this.

    Sure, you can say "well, thats what you get when you outsource stuff", but I dont buy that. I've worked with lots of people from India, Russia, Eastern-Europe, China - they understand and get the concepts of programming just as well as you or me. Something more sinister is at hand - is it "Antagonizing Compliance" between a sour employee and a sour manager? Is it compliance with a tersely worded spec that ridiculously demands "each and every parameter will be checked on entry and exit, in each and every call" [I've seen crap like that].

    Or is it just someone who plainly doesnt get it? I hope this isnt the case - oh it would be sad to think that someone next to me might be perpetrating a coding-crime like this, and actually mean it!

  • toxik (unregistered) in reply to Quietust
    Anonymous:
    The fun part comes when Boolean.ToString() is localized to return true/false strings in the appropriate language, at which point m_ISO9001.ToString().ToUpper() returns "VRAI"/"FAUX" on a computer in France and the program dies horribly.


    I don't do much C# but I would assume they removed localized Boolean string-castings as of VB6.

    <font size="1">I may or may not be wrong</font>
  • (cs)

    They know something you don't.  In 2012, MS will release a quantum computer compatible version of the .net runtime that will replace the two-valued boolean with a fuzzy value that can take any value between false and true. Think of it as a float, constrained to a value between 0 and 1. 0=false, 1=true, 0.5=maybe, 0.2=rather not, 0.9=most likely etc. The way they programmed this property, they can make sure that only true and false slip through, not those undecided other values.

  • (cs)

    This is not a  WTF - it is just garbage.

    Where's the brillance?

    Where's the juice?

    Where's the factoring of CSS back into each and every element to which it should be applied?

    Where's the inspired stupidity?

    The essential 'NOT GETTING IT'?

    A WTF is breathtakingly a WTF.

    This is not even worth a comment.

    I seriously considered not pressing the 'post' button.  I think I will just blow away the window...

  • AnonymousJack (unregistered) in reply to someone
    Anonymous:
    Anonymous:
    first


    Dumb

    This guys ip should be banned

    Is this a first form or the daly wtf form?


    I'm pretty sure it's a forum
  • (cs) in reply to APAQ11
    Anonymous:

        bool v_ISO9001 = value;
        //can only be true or false
        if (v_ISO9001.ToString().ToUpper() == "TRUE" ||
            v_ISO9001.ToString().ToUpper() == "FALSE") { m_ISO9001 = v_ISO9001; } else
        {
          throw new ArgumentException();
        }

    Wouldn't the [bool v_ISO9001 = value;] part throw an exception if  value couldn't be made into a bool type anyways thus making the rest of this code pointless?

    Yes.

  • W (unregistered) in reply to Jake Vinson
    Jake Vinson:
    Wow, think of all the lines of code that could be used to validate that an integer is an integer.  Or testing every possible string combination.  That's like infinity billion lines!


    Pffft you don't need infinite lines, you can recurse infinitely!


    <?php // I like PHP<br>function isValidInt($variable)
    {
       if ($variable == 0) { return true; }
       elseif ($variable < 0) { return isValidInt($variable + 1) }
       elseif ($variable > 0) { return isValidInt($variable - 1) }
       else { return false; }
    }
    ?>


    Now, in PHP that's a funny useless waste of processor time
  • (cs)

        if (m_ISO9001.ToString().ToUpper() == "TRUE"){return true;}
    else if(m_ISO9001.ToString().ToUpper() == "FALSE"){return false;}
    else return m_ISO9001;

    The real WTF is that he ends up returning the value of m_ISO9001 no matter what it is! Unless he somehow understands the concept of the keywords true and false as being special and yet thinks a Boolean can evaluate to true without being true, or maybe... oh, I give up.

  • xcor057 (unregistered)

    Obviously they were trying to address the quantum theory of superposition.  One can never know if a boolean is true or false until it is acted on.

  • (cs) in reply to xcor057
    Anonymous:
    Obviously they were trying to address the quantum theory of superposition.  One can never know if a boolean is true or false until it is acted on.

    I surf the Quantum Foam.
  • Wayne (unregistered)

    That made my day.  Thanks!

    I wonder if this outsourcing shop was CMM level 5.  I wonder if it had all this redundant code because it was CMM level 5.

  • (cs) in reply to Anon
    Anonymous:
    The Daily WTF zings Slashdot; Slashdot takes a shot at Digg.  What's next? Digg attacks Fark?


    Nerd fight!
  • (cs) in reply to MikeMontana
    MikeMontana:
    Without bashing the developer, I would really want to know why the developer really felt it was important to go this route. Absolutely, this is "wtf-code", but, someone actually sat down to think this out - I would have to ask myself "why didnt they see the circular logic in using a Bool, casting to a String, and checking the string result in a boolean fashion?"

    Something is critically wrong when a developer, who obviously understands the OO principles of Get/Set and constructs of IF..THEN..ELSE plus Casting, yet, writes total bunk like this.

    Sure, you can say "well, thats what you get when you outsource stuff", but I dont buy that. I've worked with lots of people from India, Russia, Eastern-Europe, China - they understand and get the concepts of programming just as well as you or me. Something more sinister is at hand - is it "Antagonizing Compliance" between a sour employee and a sour manager? Is it compliance with a tersely worded spec that ridiculously demands "each and every parameter will be checked on entry and exit, in each and every call" [I've seen crap like that].

    Or is it just someone who plainly doesnt get it? I hope this isnt the case - oh it would be sad to think that someone next to me might be perpetrating a coding-crime like this, and actually mean it!

    I would have to guess a code generator did this. No sane person would go though all of that without having to think to themselves, "This looks so enterprisy!"

  • (cs)

    Oh ho, you laugh at this WTF, but it's not a WTF, it's a carefully planned performance upgrade! Just think about it.... they can increase the performance of the ISO9001 property by an order of magnitude in their next version by simply deleting the ToString().ToUpper() calls and the senseless "make sure it's a boolean" check in the set method.

    I'm telling you, this isn't a WTF, this is planned incompetence!

  • (cs) in reply to Sean

    Sean:
    Anonymous:
    The Daily WTF zings Slashdot; Slashdot takes a shot at Digg.  What's next? Digg attacks Fark?


    Nerd fight!

    Hehee... am I the only one imagining Kyle and Cartman's limp-wristed slap-fight on South Park last week when I hear those words? [:D]

  • Nomen Nescio (unregistered) in reply to Whiskey Tango Foxtrot? Over.

    So... does verifying that all booleans are either true OR false, help one become a ISO 9001 compliant enterprise programmar?

  • ampersander (unregistered) in reply to Whiskey Tango Foxtrot? Over.

    When I read the title I feared some guy managed to programmatically go through several internet protocols, office documents and executables just to validate a value. Compared to the other wtfs this is just harmless tomfoolery.

  • Brian (unregistered)

    Could this be the remainders of code refactored from

    public string ISO9001 { get {...} set {...} }

    or worse

    public object ISO9001 { get{...} set {...} }?

  • phsx (unregistered) in reply to marvin_rabbit
    marvin_rabbit:
    Anonymous:
    Obviously they were trying to address the quantum theory of superposition.  One can never know if a boolean is true or false until it is acted on.

    I surf the Quantum Foam.

    This is definitely an applicatino of String Theory!
  • Monday (unregistered)

    If IsTrue()?

  • (cs) in reply to W
    Anonymous:
    Jake Vinson:
    Wow, think of all the lines of code that could be used to validate that an integer is an integer.  Or testing every possible string combination.  That's like infinity billion lines!


    Pffft you don't need infinite lines, you can recurse infinitely!


    function isValidInt($variable)
    {
       if ($variable == 0) { return true; }
       elseif ($variable < 0) { return isValidInt($variable + 1) }
       elseif ($variable > 0) { return isValidInt($variable - 1) }
       else { return false; }
    }
    ?>


    Now, in PHP that's a funny useless waste of processor time


    I think you missed the point of the LOC metric. Clue brick - coming your way.

    sincerely,
    Richard Milhouse Nixon
  • (cs) in reply to ampersander

    Many whiny people:
    Where's the WTF?

    IMO, a programmer doesn't have to vomit into his IDE in order to produce a WTF.  Someone had to understand that a boolean produced true or false, and then added logic for those "other" values.  Think of it like this... if I, as a developer, walked up to you and said, "If I don't want a boolean to be true or false, what value do I set it to?", what response do you think would go through your mind?

    Anything that makes you say WTF...  is by definition, a WTF.

  • Wayne (unregistered) in reply to phsx

    Anonymous:
    marvin_rabbit:
    Anonymous:
    Obviously they were trying to address the quantum theory of superposition.  One can never know if a boolean is true or false until it is acted on.

    I surf the Quantum Foam.

    This is definitely an applicatino of String Theory!

    Is an applicatino one of the fundamental particles of computing?

  • Me (unregistered)

    This is one real whopper. Really...just off the charts.

  • (cs) in reply to toxik

    may-or-may-not-be-wrong That's the next-gen Boolean! New and improved for enterpricy, value driven and customer adding SOA and XML based BI/ERP systems that may-or-may-not-be FileNotFoundException.

    Order now! And get a free press release from Microsoft stating how much they are better than Linux.

    Next-Gen Boolean, It's just Brillant! And you knwo, Paula (who is now outsourced to Mongolia) said it!

  • krftsman (unregistered) in reply to Digitalbath

    Wouldn't it simply not compile if value wasn't a bool?  The property is defined as a bool, therefor, value will always be a bool, no?

  • neek (unregistered)

    <font size="2">come on! does Paula code in c# too?

    return 'Brillant!';
    </font>

Leave a comment on “Outsourced Property Value”

Log In or post as a guest

Replying to comment #:

« Return to Article