• ParkinT (unregistered)

    This was obviously written by someone unfamiliar with the "ToLower()" class. What is returned if I supply it with "trUe"?

  • DonaldK (unregistered)

    Deep frown deepens...

  • (cs)

    How do you start on a contact? And how many weeks are a copule weeks? Sorry, I'm not a native English speaker, so I might not know certain idioms or words.

  • (cs)

    Oh! And fr1st! And and and what if you use oFf? That won't do! Who's the incompetent git that forgot oFf in that list? No end-year bonus for him!

  • (cs)

    And obviously... this StringSettingBool being a class, nobody got the bright idea to something like a toLower in both the constructor and in the instance method that checks whether the passed string is true or false (or file not found).

  • Machtyn (unregistered)

    Ah! stolen thunder in the fr1st p0st.

    I was going to add that they forgot nO, yEs, yeS, yES, YeS, YEs, etc.

  • Guru (unregistered) in reply to The poop of DOOM
    The poop of DOOM:
    How do you start on a contact? And how many weeks are a copule weeks? Sorry, I'm not a native English speaker, so I might not know certain idioms or words.

    Don't worry, Alex looks like Greek to me too

  • Warren (unregistered)

    "I should have printed it out frist"

    FTFY

  • (cs)

    Comment cOmment coMment comMent commEnt

    oh whatever...

  • (cs)

    The most important thing is missing, of course ...

    FILE_NOT_FOUND as seen here: [image]

  • DCRoss (unregistered)

    Stop. stop. STOP. StOp. stoP.

    Is it working yet?

  • (cs)

    Must be junor programer.

  • (cs) in reply to ParkinT
    ParkinT:
    This was obviously written by someone unfamiliar with the "ToLower()" class. What is returned if I supply it with "trUe"?

    ToLower(), of course, being a method, not a class.

  • Steve (unregistered)

    Not that I want to defend this piece of code, but the main criticism so far of it not accounting for things like sTart and such is almost unfair - they've accounted for any variation that a sane human might use. "START", "start" and "Start", for example. A casual glance at those and you wouldn't immediately think it's a typo (unless your coding style dictates that it is). However, if you looked at sTart, unless you're using Hungarian notation and have some sort of string Tart, then you'd immediately think it looks wrong.

    Of course, that's besides the point in which this kind of boolean handling is just wrong.

  • Bronie (unregistered)
  • adam (unregistered)

    you want the truth? you cant handle the truth

  • mUlDeR (unregistered)

    the truth is out there...

  • (cs) in reply to Steve
    Steve:
    Not that I want to defend this piece of code, but the main criticism so far of it not accounting for things like sTart and such is almost unfair - they've accounted for any variation that a sane human might use. "START", "start" and "Start", for example. A casual glance at those and you wouldn't immediately think it's a typo (unless your coding style dictates that it is). However, if you looked at sTart, unless you're using Hungarian notation and have some sort of string Tart, then you'd immediately think it looks wrong.

    Of course, that's besides the point in which this kind of boolean handling is just wrong.

    You obviously haven't been in IT for long. People calling that function (either other devs or end-users) WILL find a way to enter sTart, even if it's something like a twitchy shift key.

    You'd argue no sane person'd do that, but on this keyboard, for example, my N key sometimes doesn't catch a hit, leaving the letter out. I'm sane (officially. Got a certificate saying I'm not nuts!), yet due to my N key, you can't trust my input will have the letter N where it should be.

    Same goes for randomly capitalized characters. You can't simply assume nobody'll do that, as you just don't know the conditions in which it's written, nor the person writing it.

  • Funkenstein (unregistered)

    "The truth is out there"

    beLieve

  • froggy evenings (unregistered)

    Case issues aside, we're still missing some obvious possibilities. We have yes/no, start/stop, on/off. What about yep/nope, yeah/nah, yes please/no thank you, 1/0, etc. Or maybe instead of start/stop someone tries go/stop. Point being, you need a pretty large dictionary to do this.

  • Gordy Gekko (unregistered) in reply to Nagesh
    Nagesh:
    Must be junor programer.

    Or offshore Indian code. Same difference, really.

  • Bryan the K (unregistered)

    Clearly the problem is you forgot to handle for the third Boolean state.

    True/False/NaN amirite?

  • (cs)

    Your sneakernet skillz are highly deficient, KY.

  • (cs) in reply to Machtyn
    Machtyn:
    Ah! stolen thunder in the fr1st p0st.

    I was going to add that they forgot nO, yEs, yeS, yES, YeS, YEs, etc.

    How do you know they did? You can only see the first few rows: those values are probably at the end, each one added separately in response to a ticket from a PHB who had trouble with his CapsLock key...

  • Guru (unregistered) in reply to The poop of DOOM
    The poop of DOOM:
    You obviously haven't been in IT for long. People calling that function (either other devs or end-users) WILL find a way to enter sTart, even if it's something like a twitchy shift key.

    Well, they will happily find InvalidArgumentException in this case

    Captcha: abigo. abistop.

  • Jodrell (unregistered) in reply to The poop of DOOM

    isn't that "uts"

  • (cs) in reply to The poop of DOOM
    The poop of DOOM:
    I'm sane (officially. Got a certificate saying I'm not nuts!)
    I know this is a cultural reference, but I can't remember to what. Is it Rimmer from Red Dwarf?
  • Explaining the Joke (unregistered) in reply to pjt33

    A certificate indicating that he is not insane is the result of a process which had cause to bring his sanity into question. That is, either he had been certified insane and gotten better, or had done or does do something which requires documentation that he is not insane officer, thank you for you kindness, but I'll be leaving the baby up on that lamppost this evening.

  • (cs) in reply to The poop of DOOM
    The poop of DOOM:
    I'm sane (officially. Got a certificate saying I'm not nuts!.
    I find that highly unlikely.
  • your name (unregistered)

    TRWTF is that there is no wooden table involved.

  • Stabbitha (unregistered) in reply to ParkinT

    TRWTF is that you think ToLower() is a class ...

  • (cs)

    22 ways to express boolean values ought to be enough for anybody.

  • Could I Bother You to Recharge My Zune? (unregistered) in reply to pjt33
    pjt33:
    The poop of DOOM:
    I'm sane (officially. Got a certificate saying I'm not nuts!)
    I know this is a cultural reference, but I can't remember to what. Is it Rimmer from Red Dwarf?
    The show has a guy named "Rimmer"?! Hulu here I come!
  • (cs)

    I love the comment:

    // boolean flags, add as necessary

    Add as necessary. Now we know how this code came to be.

  • Mojo Monkeyfish (unregistered)

    The REAL REAL WTF is all the ToLower() fanboys here, when ToUpper() is obviously superior. There's nothing a totally lowercase string can do, that a totally uppercase string can't do louder.

  • r3zn1k (unregistered) in reply to Mojo Monkeyfish
    Mojo Monkeyfish:
    The REAL REAL WTF is all the ToLower() fanboys here, when ToUpper() is obviously superior. There's nothing a totally lowercase string can do, that a totally uppercase string can't do louder.

    :D

  • (cs) in reply to pjt33
    pjt33:
    The poop of DOOM:
    I'm sane (officially. Got a certificate saying I'm not nuts!)
    I know this is a cultural reference, but I can't remember to what.
    Doctor: Mr. Simpson, after talking to your wife, we believe you're no threat to yourself or others. Homer: That's the most flattering thing anyone has ever said to me. Can I have it in writing, please? Doctor: Of course!
    This certifies HOMER SIMPSON not insane.
  • anonymouser (unregistered)

    Shouldn't the starts be false? I mean, for that company at least.

  • Daniel (unregistered)

    What language is this? Seems to come from Visual Studio. Is it Visual Basic?

  • (cs)

    I've done stuff like this in the past, but only when I'm converting a free-form field into a lookup or a particular type, and is always throwaway SQL code...

    In fact, on my last project, I saw several instances where bool was represented as "Yes\No", "Open\Closed", etc., etc. The justification? "Oh, the client wanted to see that on the web page rather than a checkbox".... face-palm

    Naturally, there was fragile logic throughout the code-base to convert to and from a bool where it would either look at the whole word, just the first character, ToUpper, ToLower, blah blah blah...

  • Cavity Creep (unregistered) in reply to The poop of DOOM
    The poop of DOOM:
    Steve:
    Not that I want to defend this piece of code, but the main criticism so far of it not accounting for things like sTart and such is almost unfair - they've accounted for any variation that a sane human might use. "START", "start" and "Start", for example. A casual glance at those and you wouldn't immediately think it's a typo (unless your coding style dictates that it is). However, if you looked at sTart, unless you're using Hungarian notation and have some sort of string Tart, then you'd immediately think it looks wrong.

    Of course, that's besides the point in which this kind of boolean handling is just wrong.

    You obviously haven't been in IT for long. People calling that function (either other devs or end-users) WILL find a way to enter sTart, even if it's something like a twitchy shift key.

    You'd argue no sane person'd do that, but on this keyboard, for example, my N key sometimes doesn't catch a hit, leaving the letter out. I'm sane (officially. Got a certificate saying I'm not nuts!), yet due to my N key, you can't trust my input will have the letter N where it should be.

    Same goes for randomly capitalized characters. You can't simply assume nobody'll do that, as you just don't know the conditions in which it's written, nor the person writing it.

    It seems like you guys are promoting truth decay.

  • Hater (unregistered) in reply to C-Octothorpe
    C-Octothorpe:
    I've done stuff like this

    Like if someone cares about your faulty experience.

  • (cs) in reply to Hater
    Hater:
    C-Octothorpe:
    I've done stuff like this

    Like if someone cares about your faulty experience.

    Yes, just like if that.
  • (cs) in reply to Hater
    Hater:
    C-Octothorpe:
    I've done stuff like this
    Who hasn't?
    fTFY
  • (cs) in reply to Steve
    Steve:
    Not that I want to defend this piece of code, but the main criticism so far of it not accounting for things like sTart and such is almost unfair - they've accounted for any variation that a sane human might use. "START", "start" and "Start", for example. A casual glance at those and you wouldn't immediately think it's a typo (unless your coding style dictates that it is). However, if you looked at sTart, unless you're using Hungarian notation and have some sort of string Tart, then you'd immediately think it looks wrong.

    Of course, that's besides the point in which this kind of boolean handling is just wrong.

    No, it also misses stuff like STart, FAlse, etc. which MS products automatically convert to Start, False, etc. It's so easy to mistime the removal of the finger from the SHift key (see?) when typing a word with the first letter capitalised. So you've got to add those too.

    And don't forget, there's also "sTART" and "stART" etc. etc. for all those people who have forgotten they've left the caps lock on, and whose finger-timing is equally messy as that which has been specified above.

    We also need to cater for variants on "sotp" and "satrt" etc, in case the fingers have got really fumbled, and also "ario" for the person who wanted to type "stop" but whose fingers were one key too far to the left.

    So there's till plenty of work to do. I'd get Nagesh onto it straight away.

  • (cs) in reply to Could I Bother You to Recharge My Zune?
    Could I Bother You to Recharge My Zune?:
    pjt33:
    The poop of DOOM:
    I'm sane (officially. Got a certificate saying I'm not nuts!)
    I know this is a cultural reference, but I can't remember to what. Is it Rimmer from Red Dwarf?
    The show has a guy named "Rimmer"?! Hulu here I come!
    Based, apparently, on a real-world school prefect with that name. Yes, it is a not-unheard-of name in the UK. I even had a teacher with that surname, and she was even more unpleasant than the character of that name in Red Dwarf (because she wasn't funny like him).
  • (cs) in reply to QJo
    QJo:
    Steve:
    Not that I want to defend this piece of code, but the main criticism so far of it not accounting for things like sTart and such is almost unfair - they've accounted for any variation that a sane human might use. "START", "start" and "Start", for example. A casual glance at those and you wouldn't immediately think it's a typo (unless your coding style dictates that it is). However, if you looked at sTart, unless you're using Hungarian notation and have some sort of string Tart, then you'd immediately think it looks wrong.

    Of course, that's besides the point in which this kind of boolean handling is just wrong.

    No, it also misses stuff like STart, FAlse, etc. which MS products automatically convert to Start, False, etc. It's so easy to mistime the removal of the finger from the SHift key (see?) when typing a word with the first letter capitalised. So you've got to add those too.

    And don't forget, there's also "sTART" and "stART" etc. etc. for all those people who have forgotten they've left the caps lock on, and whose finger-timing is equally messy as that which has been specified above.

    We also need to cater for variants on "sotp" and "satrt" etc, in case the fingers have got really fumbled, and also "ario" for the person who wanted to type "stop" but whose fingers were one key too far to the left.

    So there's till plenty of work to do. I'd get Nagesh onto it straight away.

    "ario", but also "qrio" for people who use French keyboards. And don't forget the Dvorak users, either.

    While we're at it, stqrt, stQRT, etc. as well, for people used to either a qwerty or an azerty keyboard and having to type on the other kind (triple that for Dvorak)

  • (cs) in reply to pjt33
    pjt33:
    The poop of DOOM:
    I'm sane (officially. Got a certificate saying I'm not nuts!)
    I know this is a cultural reference, but I can't remember to what. Is it Rimmer from Red Dwarf?
    Ah, I think it was Sheldon from The Big Bang Theory.
    I'm not insane: my mother had me tested.
  • (cs) in reply to Hater
    Hater:
    C-Octothorpe:
    I've done stuff like this

    Like if someone cares about your faulty experience.

    Wow, only three minutes before you're reply... You must be sitting there F5ing, just waiting for me to post something...

    We are transported to Hater's bedroom [A dark, musty basement cluttered with old boxes and empty take-out containers. The only light provided is from an aging CRT monitor sitting atop a rickety Ikea computer desk, next to an impressive pile of used, um, facial tissues...]

    Hater: "HA HA! I have him NOW!"

    clickety click click

    Hater reads to himself: "You are dum. Nobodi like yu"

    PURE GENIUS!!!!

    [The basement door opens.]

    Hater's mom: Godammit Melvin! I told you to stop leaving your dirty underwear in the bathroom!

    Melvin (aka Hater): Aw, come on mom, can't you see I'm busy?!

  • C# Guy (unregistered) in reply to froggy evenings
    froggy evenings:
    Case issues aside, we're still missing some obvious possibilities. We have yes/no, start/stop, on/off. What about yep/nope, yeah/nah, yes please/no thank you, 1/0, etc. Or maybe instead of start/stop someone tries go/stop. Point being, you need a pretty large dictionary to do this.

    The developers behind this are well ahead of you, they have already put in a comment say // add as necesary. How much more future proof can you get?

    I will share this amongst my team as an example of good development practice.

Leave a comment on “Truth Enough”

Log In or post as a guest

Replying to comment #:

« Return to Article