• M (unregistered) in reply to Drew
    Drew:
    Cbuttius:
    We could do skipValidation &&= predicate though.

    What language has that operator?

    Not C - as I found out when I tried to use it :-) Why it is missing from C I don't know :-(

  • Brent (unregistered) in reply to Someone who can't be bothered to login from work
    Someone who can't be bothered to login from work:
    At a basic level you could just have NAND and NOR, because they're functionally complete.

    That's NAND xor NOR. You don't need both to be functionally complete (so "and" is overkill), and if you have both it wouldn't be at the most basic level (so "xor" instead of "or").

  • golddog (unregistered)
    Now just imagine the fun E.H. has with such quandaries line-after-line and day-after-day.
    Does E.H. refactor this code when he comes across it, or leave it and bitch?

    That's acutally one of the things I find fun about my job; taking some crap code and refactoring it into something good. makes me feel I've made our little world slightly better.

  • (cs) in reply to Mason Wheeler
    Mason Wheeler:
    "I didn't do nothing with nobody."

    My standard answer to most questions from the age of 14 to 17.

  • Bill's kid (unregistered) in reply to Matt K
    Matt K:
    frits:
    This is only a WTF if statusIsNotValid is a boolean. If it is some other type, this really isn't much of a WTF.

    Troll or idiot?

    both?

  • Sigh (unregistered) in reply to golddog
    golddog:
    Now just imagine the fun E.H. has with such quandaries line-after-line and day-after-day.
    Does E.H. refactor this code when he comes across it, or leave it and bitch?

    That's acutally one of the things I find fun about my job; taking some crap code and refactoring it into something good. makes me feel I've made our little world slightly better.

    Yep, there's no better feeling than rewording code without actually changing it.

  • Ajtacka (unregistered) in reply to golddog
    golddog:
    Now just imagine the fun E.H. has with such quandaries line-after-line and day-after-day.
    Does E.H. refactor this code when he comes across it, or leave it and bitch?

    That's acutally one of the things I find fun about my job; taking some crap code and refactoring it into something good. makes me feel I've made our little world slightly better.

    I agree with you, but... there are some hellhole offices that frown on refactoring - why waste time changing something that already works? Also, refactoring this could become a full-time job if there are enough lines like this.

  • Mike D. (unregistered) in reply to Robert
    Robert:
    TheRealWTF:
    The Real WTF is that Alex totally missed out FILE_NOT_FOUND.

    and what about XOR

    a XOR b = (a OR b) AND NOT (a AND b)

    ... You know what? Use (a + b) & 1, and we'll call it a day.

  • wtf (unregistered) in reply to DonaldK
    DonaldK:
    Matt:
    I can't not misunderstand what he was not trying to unachieve.

    Let's break it down:

    can't not = CAN ... I CAN misunderstand what he was not trying to unachieve.

    CAN misunderstand = misunderstand = do not understand ... I do not understand what he was not trying to unachieve.

    not trying to unachieve = trying to achieve ... I do not understand what he was trying to achieve.

    Ditto.

    No, not in English at least.

    can't not = MUST (ie, can't avoid) CAN misunderstand = can misunderstand (or not) (but this doesn't appear in Matt's sentence) not trying to unachieve = meaningless, unless "unachieve" means something, which it doesn't. But suppose it meant "not achieve". Then "not trying to unachieve" would mean "not trying to not achieve", which would mean a state of near total unconcern as to whether the thing was achieved or not. "I'm not trying to not achieve the goal" says nothing about whether I'm trying to achieve it or not - it only means I'm not trying to fail.

    So Matt's sentence "I can't not misunderstand what he was not trying to unachieve" actually would mean "I have to misunderstand what he didn't care about whether he achieved or not", but only if "unachieve" meant something in English.

    Which is even worse than today's posting. Congratulations, Matt.

  • Mike D. (unregistered) in reply to Ajtacka
    Ajtacka:
    golddog:
    Now just imagine the fun E.H. has with such quandaries line-after-line and day-after-day.
    Does E.H. refactor this code when he comes across it, or leave it and bitch?

    That's acutally one of the things I find fun about my job; taking some crap code and refactoring it into something good. makes me feel I've made our little world slightly better.

    I agree with you, but... there are some hellhole offices that frown on refactoring - why waste time changing something that already works? Also, refactoring this could become a full-time job if there are enough lines like this.
    Because it always looks good to your boss when you spend the whole day working on something with no visible impact on the delivered product. Or, in other words: "Promote someone else who is actually productive."

    If it makes you feel better, remember that your own DNA is also full of junk code from sundry sources and has no comments.

  • Mike D. (unregistered) in reply to wtf
    wtf:
    So Matt's sentence "I can't not misunderstand what he was not trying to unachieve" actually would mean "I have to misunderstand what he didn't care about whether he achieved or not", but only if "unachieve" meant something in English.
    What if "unachieve" means "to nullify an achievement, as if that achievement never happened"? Kind of like "uncommitting" a change to a repository (by reverting to an old backup, if the VCS can't do it).
  • I'd do this differently (unregistered) in reply to Jakob H. Poulsen

    Actually, the way I'd code this is:

    First change statusIsNotValid to statusIsValid, then:

    if (statusIsValid) { // ... perform validation ... }

  • Bert Glandstorm (unregistered) in reply to golddog
    golddog:
    Now just imagine the fun E.H. has with such quandaries line-after-line and day-after-day.
    Does E.H. refactor this code when he comes across it, or leave it and bitch?

    That's acutally one of the things I find fun about my job; taking some crap code and refactoring it into something good. makes me feel I've made our little world slightly better.

    This is the refactored version. The original version was

    if (statusIsNotValid.isNotValid() != true) skipValidation = !true;
    
  • Red (unregistered) in reply to wtf
    wtf:
    *SNIP*

    So Matt's sentence "I can't not misunderstand what he was not trying to unachieve" actually would mean "I have to misunderstand what he didn't care about whether he achieved or not", but only if "unachieve" meant something in English.

    Which is even worse than today's posting. Congratulations, Matt.

    Oh, do f*ck off!

    ;-)

  • Bert Glandstorm (unregistered) in reply to frits
    frits:
    Mason Wheeler:
    "I didn't do nothing with nobody."

    My standard answer to most questions from the age of 14 to 17.

    Dear frits,

    In case you can’t tell, this is a grown-up place. The fact that you insist on using this ridiculous expression clearly shows that you’re too young and too stupid to be using thedailywtf.com.

    Go away and grow up.

    Sincerely, Bert Glanstron

  • (cs) in reply to golddog
    Mike D.:
    Ajtacka:
    golddog:
    Now just imagine the fun E.H. has with such quandaries line-after-line and day-after-day.
    Does E.H. refactor this code when he comes across it, or leave it and bitch?

    That's acutally one of the things I find fun about my job; taking some crap code and refactoring it into something good. makes me feel I've made our little world slightly better.

    I agree with you, but... there are some hellhole offices that frown on refactoring - why waste time changing something that already works? Also, refactoring this could become a full-time job if there are enough lines like this.
    Because it always looks good to your boss when you spend the whole day working on something with no visible impact on the delivered product. Or, in other words: "Promote someone else who is actually productive."

    If it makes you feel better, remember that your own DNA is also full of junk code from sundry sources and has no comments.

    And "no visible impact" is a best case scenario.

  • someGuy (unregistered) in reply to Someone who can't be bothered to login from work
    Someone who can't be bothered to login from work:
    At a basic level you could just have NAND and NOR, because they're functionally complete.

    actually you just need nand, you can mimic nor using it ;)

  • wtf (unregistered) in reply to Mike D.
    Mike D.:
    wtf:
    So Matt's sentence "I can't not misunderstand what he was not trying to unachieve" actually would mean "I have to misunderstand what he didn't care about whether he achieved or not", but only if "unachieve" meant something in English.
    What if "unachieve" means "to nullify an achievement, as if that achievement never happened"? Kind of like "uncommitting" a change to a repository (by reverting to an old backup, if the VCS can't do it).

    Plausible - since we're making up words, why not?

    So, "I must misunderstand what he was't actually trying to undo"? Still gibberish to me. Part of the problem is that you've got a null reference for "understand" "I understand what he didn't say" maybe makes sense in a poetic context, but not if you try to read it literally. With the extra layer of negation in there, it's hopeless.

    But the real problem is that English doesn't actually negate in a boolean fashion, especially with modal verbs. Try to negate "I have to do X", and you have two choices: "I !(have to) do X" or "I have to (!do X)". So trying to construct this sort of thing is actually a lot harder in English than it is in code.

  • (cs) in reply to Bert Glandstorm
    Bert Glandstorm:
    frits:
    Mason Wheeler:
    "I didn't do nothing with nobody."

    My standard answer to most questions from the age of 14 to 17.

    Dear frits,

    In case you can’t tell, this is a grown-up place. The fact that you insist on using this ridiculous expression clearly shows that you’re too young and too stupid to be using thedailywtf.com.

    Go away and grow up.

    Sincerely, Bert Glanstron

    Duh. That's so yesterday.

  • SARUMANATEE (unregistered) in reply to Mike D.
    Mike D.:
    What if "unachieve" means "to nullify an achievement, as if that achievement never happened"?

    Unpossible.

  • Jemmy (unregistered) in reply to Sigh
    Sigh:
    Drew:
    Sigh:
    Great, another Java moron that doesn't know how to code. Nothing to see here. Move along.

    And yes, once again for the second time in 3 days, TRWTF is Java.

    Are you implying that only Java developers write bad code? Are you implying that it is impossible to write good code with Java? Are you implying that anyone who writes in Java writes bad code?

    Or are you making comments off the cuff before you've had your coffee this morning? :)

    I'm not sure whether it's because the language attracts idiots or because it's simple enough that it's easy to get your foot in the door. Unfortunately that is my hell now when all the C/C++ jobs went the way of the dinosaur. I see WAY more incompetent coders than I used to see in the C world. Of course, I can't complain about week-long #define hunts anymore.

    @Java attracts idiots: I think Java is so omni-present in education and business that it's simply the law of large numbers kicking in. Plus, the entry-level is arguably somewhat lower than many other languages -just like COBOL, which is probably why managerial types tend to spell "JAVA" these days ;)

    Or to put it the other way around: C is pretty good at chasing away idiots who'd go on to become incompetent coders :)

  • (cs) in reply to Mike D.

    Actually our own DNA seems to get refactored all the time and only seems to stick around when it's needed. http://en.wikipedia.org/wiki/Noncoding_DNA

    Don't refactor for it's own sake but if your in the code anyway then clean it up for the next person.

  • itsmo (unregistered) in reply to Mike D.
    Mike D.:
    Ajtacka:
    golddog:
    Now just imagine the fun E.H. has with such quandaries line-after-line and day-after-day.
    Does E.H. refactor this code when he comes across it, or leave it and bitch?

    That's acutally one of the things I find fun about my job; taking some crap code and refactoring it into something good. makes me feel I've made our little world slightly better.

    I agree with you, but... there are some hellhole offices that frown on refactoring - why waste time changing something that already works? Also, refactoring this could become a full-time job if there are enough lines like this.
    Because it always looks good to your boss when you spend the whole day working on something with no visible impact on the delivered product. Or, in other words: "Promote someone else who is actually productive."

    If it makes you feel better, remember that your own DNA is also full of junk code from sundry sources and has no comments.

    Yes, but your own DNA is the result of evolution. God save us from code which has evolved rather than being designed and coded properly.

  • Don (unregistered) in reply to brazzy
    brazzy:
    Sigh:
    Great, another Java moron that doesn't know how to code. Nothing to see here. Move along.

    And yes, once again for the second time in 3 days, TRWTF is Java.

    Because using any language other than Java makes people magically unable to code crap...

    If you think Java is the problem here, TRWTF is you.

    Whooshhhh! (hand flying over head)

  • Sigh (unregistered) in reply to Jemmy
    Jemmy:
    Sigh:
    Drew:
    Sigh:
    Great, another Java moron that doesn't know how to code. Nothing to see here. Move along.

    And yes, once again for the second time in 3 days, TRWTF is Java.

    Are you implying that only Java developers write bad code? Are you implying that it is impossible to write good code with Java? Are you implying that anyone who writes in Java writes bad code?

    Or are you making comments off the cuff before you've had your coffee this morning? :)

    I'm not sure whether it's because the language attracts idiots or because it's simple enough that it's easy to get your foot in the door. Unfortunately that is my hell now when all the C/C++ jobs went the way of the dinosaur. I see WAY more incompetent coders than I used to see in the C world. Of course, I can't complain about week-long #define hunts anymore.

    @Java attracts idiots: I think Java is so omni-present in education and business that it's simply the law of large numbers kicking in. Plus, the entry-level is arguably somewhat lower than many other languages -just like COBOL, which is probably why managerial types tend to spell "JAVA" these days ;)

    Or to put it the other way around: C is pretty good at chasing away idiots who'd go on to become incompetent coders :)

    Well, I'm glad it's not just me. Sometimes I feel like the only sane person in a asylum of lunatics...and that's usually a bad sign.

  • Peter (unregistered) in reply to Cbuttius
    Cbuttius:
    Why in C if you want to test two strings for equality you might check !strcmp( str1, str2 ), although you might write that as strcmp( str1, str2 ) != 0.
    You would do better to write it as strcmp( str1, str2 ) == 0, if you want to test for equality.
  • by (unregistered) in reply to golddog
    golddog:
    Now just imagine the fun E.H. has with such quandaries line-after-line and day-after-day.
    Does E.H. refactor this code when he comes across it, or leave it and bitch?

    That's acutally one of the things I find fun about my job; taking some crap code and refactoring it into something good. makes me feel I've made our little world slightly better.

    We refactor when you can make no changes and accomplish the same result?

  • TheCPUWizard (unregistered)

    Or a great "Boolean question" (parse it with punctuation..)

    If that that is is is not that that is not not?

  • Bill&Ted (unregistered)

    That is non-non-non-non-heinous!

  • logical.. (unregistered) in reply to Sigh
    Sigh:
    bertram:
    Sigh:
    Great, another Java moron that doesn't know how to code. Nothing to see here. Move along.

    And yes, once again for the second time in 3 days, TRWTF is Java.

    There is absolutely nothing about that code snippet that guarantees that it's Java. But thanks for playing.

    I know Java crap when I see it. You must not. First clue is Boolean.FALSE. That's the constant replacement for the Boolean type false. He used the Object reference rather than the primitive because the method compareTo (implements the Comparable interface) takes an object. Camel-case is the preferred standard for variable naming, which they got right.

    If you don't believe any of these statements, I refer you to Google.

    Everyone else read this statement and thought "it probably is Java, but bertram specifically added the word 'guarantee' to his sentence, I wonder why? oh it must be because even though it is likely Java it cannot be absolutely proved".

    Apparently you read it and thought.. "ooh, nice bait.. I want to be trolled". Since you are obviously trolling yourself, I think that justice has been done.

  • (cs) in reply to Matt
    Matt:
    I can't not misunderstand what he was not trying to unachieve.

    I think you are misunderestimating yourself.

  • Coder (unregistered) in reply to Sigh
    Sigh:
    I'm not sure whether it's because the language attracts idiots or because it's simple enough that it's easy to get your foot in the door. Unfortunately that is my hell now when all the C/C++ jobs went the way of the dinosaur. I see WAY more incompetent coders than I used to see in the C world. Of course, I can't complain about week-long #define hunts anymore.

    Indeed. I did C/C++ programming for roughly ten years, and then switched to Java. Sometimes I think back and fondly remember the C/C++ days, until I remember seeing this gem:

    #define private public #define protected public

    Then the good old days remind me why I love being a Java programmer.

  • Beta (unregistered) in reply to Gozer Gozerian
    Gozer Gozerian:
    That's right Morrell, a tri-state boolean is actually considered minimum among professionals. Also a four and five-state booleans are sometimes used. Only six and above ones can be a bit nuts. ;)

    I guess you rookies have only seen discrete booleans.

  • Bert Glanstron + FIDONet 4ever (unregistered) in reply to campkev
    campkev:
    I think you are misunderestimating yourself.

    Dear campkey,

    In case you can’t tell, this is a grown-up place. The fact that you insist on using this ridiculous expression clearly shows that you’re too young and too stupid to be using thedailywtf.com.

    Go away and grow up.

    Sincerely, Bert Glanstron

  • wtf (unregistered) in reply to Bert Glanstron + FIDONet 4ever
    Bert Glanstron + FIDONet 4ever:
    campkev:
    I think you are misunderestimating yourself.

    Dear campkey,

    In case you can’t tell, this is a grown-up place. The fact that you insist on using this ridiculous expression clearly shows that you’re too young and too stupid to be using thedailywtf.com.

    Go away and grow up.

    Sincerely, Bert Glanstron

    Wow, I don't think I've ever seen a meme die from overuse quite that fast. Zero to pathetic in twenty-four hours, prety good.

  • wtf (unregistered)

    TRWTF is using Boolean instead of Strings

  • Bert Glanstron + FIDONet 4ever (unregistered) in reply to wtf
    wtf:
    Wow, I don't think I've ever seen a meme die from overuse quite that fast. Zero to pathetic in twenty-four hours, prety (sic) good.

    Im n ur intertubez, deletin' ur memez

  • Josh (unregistered)

    "Don't do what Donnie-Don't does. They could have made this clearer." - Bart Simpson

  • n_slash_a (unregistered) in reply to vulputate
    vulputate:
    Matt:
    I can't not misunderstand what he was not trying to unachieve.
    +1, or actually -(-(-(-(1))))

    -(((sqrt(-1) * i) ^ 2) - 2) or "featured comment!"

  • Chopper (unregistered) in reply to Bill's kid
    Bill's kid:
    Matt K:
    frits:
    This is only a WTF if statusIsNotValid is a boolean. If it is some other type, this really isn't much of a WTF.

    Troll or idiot?

    both?

    Logical OR :-)

    I remember my logic teacher telling the class that logicians spend half the time at conferences arguing with the catering staff about the meaning of "cooked breakfast OR continental breakfast" on menus (emphasis added ;-)

  • Ben L. (unregistered)

    "If status is valid, skip validation"

    [/thread]

  • Fred (unregistered) in reply to Ajtacka
    Ajtacka:
    there are some hellhole offices that frown on refactoring - why waste time changing something that already works?
    Refactoring best case: the code still does exactly what it did before.

    Refactoring worst case: you introduce new bugs because you took it upon yourself to change something that is invisible to everybody who pays your salary. Investment: greater than zero. Return on investment: zero.

  • Paul (unregistered) in reply to Jemmy
    Jemmy:
    C is pretty good at chasing away idiots who'd go on to become incompetent coders :)
    OK we've tried making computers easier for a couple decades now and look where it got us. It is time to go back to a sort of built-in competence test that winnows out the idiots before they get a chance to launch yet another cesspool.
  • similis (unregistered) in reply to Gozer Gozerian
    Gozer Gozerian:
    bertram:
    Morrell:
    tri-state boolean... now that's nuts :)

    You must be new here ;)

    That's right Morrell, a tri-state boolean is actually considered minimum among professionals. Also a four and five-state booleans are sometimes used. Only six and above ones can be a bit nuts. ;)

    Here are the minimum states needed for a universal boolean: boolean { true, false, fileNotfound, NULL, fish, 0, 1, f, t, F, T, True, False, TRUE, FALSE, Y, N, Yes, No, YES, NO, maybe, Maybe, MAYBE }

  • wtf (unregistered) in reply to Fred
    Fred:
    Ajtacka:
    there are some hellhole offices that frown on refactoring - why waste time changing something that already works?
    Refactoring best case: the code still does exactly what it did before, but it's now possible to improve and extend it without breaking stuff.

    Refactoring worst case: you introduce new bugs because you took it upon yourself to change something that is invisible to everybody who pays your salary, and your unit tests reveal that your method calls are no longer returning according to spec, so you revert to the previous kludgy hacked-together junk and try again another time.

    FTFY.

  • venio (unregistered) in reply to similis
    similis:
    Here are the minimum states needed for a universal boolean: boolean { true, false, fileNotfound, NULL, fish, -1, 0, 1, f, t, F, T, True, False, TRUE, FALSE, y, n, Y, N, yes, no, Yes, No, YES, NO, maybe, Maybe, MAYBE }
    ftfy
  • wtf (unregistered) in reply to Paul
    Paul:
    Jemmy:
    C is pretty good at chasing away idiots who'd go on to become incompetent coders :)
    OK we've tried making computers easier for a couple decades now and look where it got us. It is time to go back to a sort of built-in competence test that winnows out the idiots before they get a chance to launch yet another cesspool.

    Tell me about it - I'm dealing with Salesforce. Pity me.

  • uuang (unregistered) in reply to golddog
    golddog:
    Now just imagine the fun E.H. has with such quandaries line-after-line and day-after-day.
    Does E.H. refactor this code when he comes across it, or leave it and bitch?

    That's acutally one of the things I find fun about my job; taking some crap code and refactoring it into something good. makes me feel I've made our little world slightly better.

    I'd be scared to fix that code, I'm not 100% I know what its intent is.

  • Mike D. (unregistered) in reply to similis
    similis:
    Here are the minimum states needed for a universal boolean: boolean { ... }
    Looks good, just as long as all values are < PaulaBean.
  • uuang (unregistered) in reply to venio
    venio:
    similis:
    Here are the minimum states needed for a universal boolean: boolean { true, false, fileNotfound, NULL, fish, -1, 0, 1, f, t, F, T, True, False, TRUE, FALSE, y, n, Y, N, yes, no, Yes, No, YES, NO, maybe, Maybe, MAYBE }
    ftfy

    Apples

Leave a comment on “Boolean Illogic”

Log In or post as a guest

Replying to comment #:

« Return to Article