• AdT (unregistered)
    Comment held for moderation.
  • akatherder (cs)

    Cue the YesNoFileNotFound permutations.

  • Gerald (unregistered)

    substract 1 and take the absolute. then suddenly the values are the right way round

  • ozangunceler (unregistered)

    Man! What were they thinking ?

  • Tobs3n (unregistered)

    haha..."Do you think your enumeration is sane?" NOT!

  • Bad Taste (unregistered)

    Was this coded by someone who believed that when she says 'No!' that it really means 'Yes!'?

  • TexDex (unregistered)

    It sounds as if the person who wrote that perhaps spoke English as a second language. For native English speakers the instinctive opposite of "Yes" is "No", but others may easily make the mistake, especially if their native language isn't closely equivalent. For example, I'm horrible at remembering the genders of German nouns.

    Working at an e-commerce company that farms a little bit of the dev work out to India, I see things like this occasionally. Once I saw a variable "boolean allowGiftWrape".

  • IP (unregistered)

    Hey, why the link in the first reply go to yahoo to get to wikipedia?

  • Simon (unregistered)

    It's opposite day!

  • inglorion (unregistered)

    Two things immediately leapt to my mind when I read about the debugger:

    1. In the Bourne shell, an exit code of 0 indicates success, and any other indicates an error. Sensibly, the boolean logic of the shell uses 0 as true and any other value as false.

    2. The fact that your debugger displays the enum values as numbers, thus making it hard for you to understand what they mean, is the fault of the debugger, or perhaps the programming language; not of the programmer who wrote the program.

    The code is still insane, though.

  • /b/ (unregistered)

    i still like BoolPlus best:

    Yes, No, Perhaps

  • rbowes (cs) in reply to inglorion
    inglorion:
    Two things immediately leapt to my mind when I read about the debugger:
    1. In the Bourne shell, an exit code of 0 indicates success, and any other indicates an error. Sensibly, the boolean logic of the shell uses 0 as true and any other value as false.

    2. The fact that your debugger displays the enum values as numbers, thus making it hard for you to understand what they mean, is the fault of the debugger, or perhaps the programming language; not of the programmer who wrote the program.

    The code is still insane, though.

    1. Only if the question is, "was it successful?" and not "what's the error code?"

    2. Perhaps it isn't compiled with symbols for whatever reason.

  • XIU (cs) in reply to IP
    IP:
    Hey, why the link in the first reply go to yahoo to get to wikipedia?

    I noticed that Google does that too, when you search for something and hover over an url it shows the normal one, but when you copy it it has all this google crap before it.

  • AdT (unregistered) in reply to IP
    Comment held for moderation.
  • Mikolaj (unregistered)

    They should just change the order of enums. For any well written application it should have absolutely no effect...

  • sir_flexalot (cs)

    Yes means No and Not means Yes. Does this code suck?

  • poochner (cs) in reply to Mikolaj
    Mikolaj:
    They should just change the order of enums. For any well written application it should have absolutely no effect...
    As long as it's not a library exposing an ABI.
  • T$ (unregistered) in reply to sir_flexalot
    sir_flexalot:
    Yes means No and Not means Yes. Does this code suck?
    0
  • Anonymous Coward (unregistered) in reply to TexDex
    TexDex:
    Working at an e-commerce company that farms a little bit of the dev work out to India, I see things like this occasionally. Once I saw a variable "boolean allowGiftWrape".

    Here (in Germany, at University) i maintain an application that has database fields "firstname" and "sirname". Maybe a simple typo, but could be a lack of understanding also.

  • Mikoangelo (cs) in reply to Simon
    Simon:
    It's opposite day!

    Yes, it is.

  • T$ (unregistered) in reply to Mikoangelo
    Mikoangelo:
    Simon:
    It's opposite day!

    Yes, it is.

    No it isn't. Now who's telling the truth, me or Mikoangelo?

  • Sven (unregistered) in reply to sir_flexalot
    sir_flexalot:
    Yes means No and Not means Yes. Does this code suck?
    X Cancel?
  • whiny wee bastard (unregistered) in reply to TexDex
    TexDex:
    It sounds as if the person who wrote that perhaps spoke English as a second language. For native English speakers the instinctive opposite of "Yes" is "No", but others may easily make the mistake, especially if their native language isn't closely equivalent. For example, I'm horrible at remembering the genders of German nouns.

    Working at an e-commerce company that farms a little bit of the dev work out to India, I see things like this occasionally. Once I saw a variable "boolean allowGiftWrape".

    Yes, as a non-native speaker of English, I often misplace my W's too.

  • FredSaw (cs)

    Some id10t did the same thing in one of our apps. It's still there, complete with a comment by a frustrated subsequent developer:

    foreach( ResponseTypeEntity type in _responseTypes)
    {
    	if (type.ResponseTypeId == 1) // indicates a negative response.  I know.  The dumbass did it backward.
    	{
    		txtNo.Text = type.ResponseName;
    		txtNo.Enabled = true;
    	}
    	else if (type.ResponseTypeId == 0) // indicates a positive response
    	{
    		txtYes.Text = type.ResponseName;
    		txtYes.Enabled = true;
    	}
    }
  • Grant (unregistered)

    Before I saw that it was C++, I thought maybe 'no' was a keyword.

    Like you've never had to use 'klass' instead of class, or 'type_' instead of type.

  • rawsteak (cs)

    Borat: This Yes is NOT 0.

    captcha: NOT!

  • Gert (unregistered) in reply to Gerald

    yeah, along the way you could also multiply with 100 and divide with the square of 10 ... or just subtract the int value from 1

  • Zygo (unregistered) in reply to T$
    T$:
    Mikoangelo:
    Simon:
    It's opposite day!

    Yes, it is.

    No it isn't. Now who's telling the truth, me or Mikoangelo?

    Mikoangelo, if I remember my logic puzzles correctly...

  • Zygo (unregistered) in reply to Zygo
    Zygo:
    T$:
    Mikoangelo:
    Simon:
    It's opposite day!

    Yes, it is.

    No it isn't. Now who's telling the truth, me or Mikoangelo?

    Mikoangelo, if I remember my logic puzzles correctly...

    Oops, I don't remember it correctly. The puzzle I'm thinking of has a different solution (T$, if I asked Mikoangelo myself, would he say it's opposite day?).

    In any case, Simon is clearly lying. ;-)

  • Jno (unregistered) in reply to Zygo
    Comment held for moderation.
  • Jon W (unregistered)

    That enum is SO missing a "Brillant" entry.

    Anyway, the enum writer was probably a fan of Waynes World. Which probably tells us the age of the code (or the author).

    Captcha: "quake". Now where did I put that CD?

  • AnonCoder (unregistered)

    Yes that code is a horrendous WTF.

    The only bigger WTF is that it wasn't immediately refactored the first time someone with a clue saw it.

  • nobody (unregistered)

    So... anything that is not Yes is TRUE and therefor No, which is the opposite of FALSE, which in turn is Yes?

    At least the triple negation works... sorta.

  • savar (cs) in reply to Gerald
    Gerald:
    substract 1 and take the absolute. then suddenly the values are the right way round

    or.. i = (1-i)

  • Rank Amateur (cs)

    Yes, that is false. That is not false.

    What's so hard about it?

    Especially once you understand these are allowed answers to the following question: "Is it false to say that the value isn't true?"

    --Rank

  • foxyshadis (cs) in reply to Mikolaj
    Mikolaj:
    They should just change the order of enums. For any well written application it should have absolutely no effect...
    And then you find out it was serialized to a database.
  • sas (cs) in reply to Simon

    You're lying if you say it's Opposite Day. You can only say It's NOT Opposite Day!

  • jjacksonRIAB (unregistered) in reply to Gerald
    Gerald:
    substract 1 and take the absolute. then suddenly the values are the right way round

    Or just subtract from 1 and forget the absolute. :-)

  • pitchingchris (cs)

    I don't agree with the code, but if they just were enums to a push button response, and they matched the proper one to the proper event, no one would ever know.

  • shadowman (cs) in reply to pitchingchris

    This suit is black! Not!

  • Coyne (unregistered) in reply to Gerald
    Gerald:
    substract 1 and take the absolute. then suddenly the values are the right way round

    Much easier and even more confusing if you subtract from 1:

        (1 - var)
  • mattmoss (cs) in reply to Coyne
    Coyne:
    Gerald:
    substract 1 and take the absolute. then suddenly the values are the right way round

    Much easier and even more confusing if you subtract from 1:

        (1 - var)

    I was going to suggest the same, but let's use the enumeration values, shall we?

    Not - Not => Yes. Not - Yes => Not.

    Does that mean two wrongs make a right? Hmm...

    Not + Not => 2

    Guess naught.

  • a/c (unregistered) in reply to FredSaw
    FredSaw:
    Some id10t did the same thing in one of our apps. It's still there, complete with a comment by a frustrated subsequent developer:
    foreach( ResponseTypeEntity type in _responseTypes)
    {
    	if (type.ResponseTypeId == 1) // indicates a negative response.  I know.  The dumbass did it backward.
    	{
    		txtNo.Text = type.ResponseName;
    		txtNo.Enabled = true;
    	}
    	else if (type.ResponseTypeId == 0) // indicates a positive response
    	{
    		txtYes.Text = type.ResponseName;
    		txtYes.Enabled = true;
    	}
    }

    The WTF is that you're using magic numbers to test the result. You have to remember the inverted logic every time you use it. Chances are you're gonna screw up at least once and it'll cause problems. Defining it as an enum like the original WTF actually makes more sense.

  • Zylon (cs) in reply to Anonymous Coward
    Anonymous Coward:
    Here (in Germany, at University) i maintain an application that has database fields "firstname" and "sirname". Maybe a simple typo, but could be a lack of understanding also.
    Why would you think it was anything other than a misspelling of "surname"? "U" and "I" are even right next to each other on the keyboard.
  • iMalc (unregistered) in reply to mattmoss
    mattmoss:
    Does that mean two wrongs make a right? Hmm...

    Not + Not => 2

    Guess naught.

    Ah but two right's make a right, right? Yes + Yes => Yes!
  • Cewl (unregistered)

    Perhaps as a response to the question "Is it false that you want to download or not"?

    enum TypeDlYesNo { Yes, Not };

  • Phyzz (unregistered) in reply to iMalc
    iMalc:
    mattmoss:
    Does that mean two wrongs make a right? Hmm...

    Not + Not => 2

    Guess naught.

    Ah but two right's make a right, right? Yes + Yes => Yes!

    I'll have what that enum is having.

  • FredSaw (cs) in reply to a/c
    a/c:
    The WTF is that you're using magic numbers to test the result. You have to remember the inverted logic every time you use it. Chances are you're gonna screw up at least once and it'll cause problems. Defining it as an enum like the original WTF actually makes more sense.
    Would that the original author had done so. This was a fairly large application, involving calls to the database-stored "ResponseTypeId" records from multiple modules, and I was only assigned to correct one simple coding error with it. I assume my frustrated predecessor was assigned no more than that, as well. Let the record show that the original code was outsourced from America to India.

    I'm sure either of us would have been happy to try to rewrite the application to switch yes=0, no=1 for yes=1,no=0. But that was not our assignment, and so we were doomed--he to leave a disparaging comment in the code, and me to post it on TheDailyWTF (that's still how I think of this website, and what my coffeecup still says).

  • sergio (unregistered) in reply to inglorion
    inglorion:
    In the Bourne shell, an exit code of 0 indicates success, and any other indicates an error.
    As well as a lot of functions in libc. Just have to get used to it.
  • DrawFire (unregistered) in reply to Gerald

    Or just subtract from 1

Leave a comment on “Not the Most Thought Out Enumeration”

Log In or post as a guest

Replying to comment #:

« Return to Article