• mauve (unregistered)

    Obviously the real WTF is that the developer used the word list directly rather than using it as a training corpus for a naïve bayes classifier.

  • (cs)

    I think it is a pity they did not use some self learning routine that can handle any type of input from users...Tsk tsk tsk amateurs:

    sys> Are your sure? user> Maybe sys? Is that the same as yes?

    Now the only thing to do is to come up with a way to get the system to understand affirmatives in the second question and save them under the SET of "YES" strings or "NO" Strings....hmmm...perhaps if I recursively check with the original IF statement....

    wait...

  • dube (unregistered)

    the real wtf is: why does the user need to answer y/n questions via text input?

    who needs console apps o_0

  • Mee (unregistered) in reply to cconroy
    cconroy:
    TakeASeatOverThere:
    if (answer.equals("yar")) { return true;
    Obviously the application was designed for pirates.

    What's Pirate for "no"? "Nar"?

    If you ask a pirate something and they don't want to answer something meaning "yes", you get stabbed.

  • JimmyVile (unregistered) in reply to cconroy
    cconroy:
    TakeASeatOverThere:
    if (answer.equals("yar")) { return true;
    Obviously the application was designed for pirates.

    What's Pirate for "no"? "Nar"?

    I think it's "Nay", as in "Yea or Nay".

  • (cs) in reply to Kermos

    The current version may be a bit loose on user behavior, but they are planning to add some AI to the next version. That way the program can accept any user input and learn what it means and how to react.

    It seems like a lot of unnecessary complication but the gain in user-friendliness will be quite impressive. Imagine a pirate using this program then: "Are you sure?" "Yar" Then the program answers accordingly: "Ahoy, mate"

    The possibilities are endless.

  • Sylphon (unregistered)

    Sadly, the company I work for has people that would delight in finding which yes answer wasn't allowed so that they could submit a troubleticket, so some of our code has similarly screwy compilations of possibilities.

  • Maarten (unregistered) in reply to cconroy

    [quote user="cconroy"][quote user="TakeASeatOverThere"] What's Pirate for "no"? "Nar"?[/quote]

    Nay, but I have yet to meet a pirate that takes no for an answer.

  • Mee (unregistered) in reply to Sylphon
    Sylphon:
    Sadly, the company I work for has people that would delight in finding which yes answer wasn't allowed so that they could submit a troubleticket, so some of our code has similarly screwy compilations of possibilities.

    Bug #324982792

    Problem:

    While saving, it asked me if I wanted to overwrite the old file, I nodded at screen but question stayed frozen on the screen.

    I tried shaking my head but it didn't close!

    I need this fixed straight away so that I can return to the document.

    Severity: Immediate Fix Required

    How to reproduce this bug: Colleagues have confirmed that the dialog box freezes when they nod as well.

    Notes: My web cam definitely works, I used it this morning. I have confirmed it is plugged in via MSN.

  • (cs) in reply to Kermos
    Kermos:
    Ok the first WTF is, if it's a yes/no prompt why not have two buttons? A combo box containing yes/no a choices? Why a text field?

    The things that users can do with text fields are just horrendous. Don't ever give users text fields unless you have to! I have to deal with a bunch of crap stored into text fields that should have been combo box choices. Did you know there are apparently 38 ways to specify "Ground" as a shipping method? Try to run a query with garbage like that in a database to see all shipments that left or arrived via ground shipping.

    I think this was a console app.

    For a second, I thought this article was based off of code that I wrote. I, too, have written a class called UserInput that does something similar in this readConfirmation() method. I'm pretty sure I put all the valid responses in a Set, though, and I'm also pretty sure I limited it to just "y" and "yes".

    Now, if you excuse me, I need to go add "yar" to the Set...

  • Saint Gerbil (unregistered) in reply to G

    Why type "yes" when you can just hit "y" I've just tripled my productivity.

  • Vollhorst (unregistered)

    Could be some kind of joke that is running around the office and no one was able to kill it yet. During the good old startup times we had a lot of those were when reviewing code you found a stupid code section like this one you just extended it.

    Some things aren't done because someone thought they make sense but because someone knew they didn't.

  • (cs) in reply to darkmattar
    darkmattar:
    Since "Y" is the very first thing listed.... I sure hope MY sarcasm detector is broken. I'm being kind and assuming the UserInput class automatically casts 'answer' to lowercase as the first thing it does.

    Two problems.

    First, the very first thing listed isn't "Y". It's "y". They're not the same.

    Second, after looking at the code, you "assumed" there was a cast of 'answer' to lowercase as the first thing it does. Given the quality of the code submitted, this is a ridiculous assumption.

    darkmattar:
    I bet if we could see the program's input window, and meet the persons that the programmer has to deal with, this would make more sense. It reminds me of situations at my own work anyway... The input dialog asks the user to enter [Y] or [N], but one user doesn't like this and requests that 'Yes' and 'Yep' be allowed. So the programmer adds them - see the first if-block.

    The programmer's first mistake. He should have not added anything, but simply checked the first letter for "Y" or "y" and ignored the request.

    darkmattar:
    Next the user asks for 'Ok' to work too... see next if-block.

    Programmer's second (and worse) mistake. OK is not an acceptable answer to a Yes/No question. It's as unacceptable as a question in a dialog (actually used by a former developer here - thank God she's gone):

    Are you sure you want to continue?

    [Yes] [Ok] [Abort] [Cancel]

    darkmattar:
    Now the programmer just gets irritated and puts in every form of YES that he can think of off the top of his head, out of a fit of code rage. It's like road rage, except with more semi-colons.

    Now the programmer continues to be more of an idiot than the user he's dealing with. Third mistake.

    darkmattar:
    It sure looks like something I'd do in the above scenario just to be an asshat....

    OK. I won't argue with the last sentence above. <g> I wouldn't do it myself, as I know I'd have to maintain it and have to deal with other stupid user requests if I let them get away with something like this, but what you[/] do is [b]your problem.

  • Adam (unregistered)

    What about True, False, and of course our good friend "File not found"?

  • (cs) in reply to aliquam
    aliquam:
    If you know the majority of the test will be false use the == operator which is slower when true, but twice as fast when false...
    And, produces false negatives (at least in Java). There's no guarantee the String obtained through the dialogue will have been interned.

    If you want it to be fast, gotta use some form of sorting. A binary tree or trie would be good.

  • (cs) in reply to darkmattar
    darkmattar:
    tdittmar:
    andrewbadera:
    Soooooo .... why did it hang? Looks like valid script to me.
    Hm. Enter "Y" and see what happens... Is my sarcasm detector broken?

    Since "Y" is the very first thing listed.... I sure hope MY sarcasm detector is broken. I'm being kind and assuming the UserInput class automatically casts 'answer' to lowercase as the first thing it does.

    Well, I did not assume anything about case conversion, thus my "Try and hit 'Y' (capital)" remark. If all input was lower cased, of course, you'd be right. Still it would be no reason for the application to hang, but maybe that's another story and completely unrelated to the UserInput class...

    However, I'd go with the "It's a game" option, where each developer must add another yes/no option when he modifies the application.

  • Mio (unregistered) in reply to Mee
    Mee:
    cconroy:
    TakeASeatOverThere:
    if (answer.equals("yar")) { return true;
    Obviously the application was designed for pirates.

    What's Pirate for "no"? "Nar"?

    If you ask a pirate something and they don't want to answer something meaning "yes", you get stabbed.

    That seems a little tricky to represent as a string. We'll have to roll some kind of action class especially for this prompt that can be easily compared to a string for the regular "no", "nay", "nein", "NEVER!!!11!!!" responses.

  • (cs) in reply to KenW
    KenW:
    The programmer's first mistake. He should have not added anything, but simply checked the first letter for "Y" or "y" and ignored the request.

    Won't work. What if I answer in German? Then it would be "J" or "j" for "Ja".

    Or, what if I answer in Japanese? Now your options for yes are "u" and "h" (un / hai) and your options no are "u" or "i" (uun / iie). And yes as you can see, "u" is ambiguous. Oh and what if I enter my answer in hiragana? Now you need to add う、は、い and you still have the problem with う being ambiguous...=)

  • aristos_achaion (unregistered) in reply to Darron
    Darron:
    It's a game. Every developer who passes through this code is supposed to add one word to each of the true and false lists.
    //...buffalo buffalo buffalo...
  • vindico (unregistered) in reply to Saint Gerbil
    Saint Gerbil:
    Why type "yes" when you can just hit "y" I've just tripled my productivity.
    I can out produce you!

    I'll just run the following "yes|{this program}" and go to lunch and be infinitely more productive!

  • (cs) in reply to vindico
    vindico:
    Saint Gerbil:
    Why type "yes" when you can just hit "y" I've just tripled my productivity.
    I can out produce you!

    I'll just run the following "yes|{this program}" and go to lunch and be infinitely more productive!

    Wow that's great, Lyle

  • Jo3sh (unregistered) in reply to Mee
    Mee:
    If you ask a pirate something and they don't want to answer something meaning "yes", you get stabbed.

    So there's a hardware component as well?

  • parris (unregistered) in reply to Kermos
    Kermos:
    Ok the first WTF is, if it's a yes/no prompt why not have two buttons? A combo box containing yes/no a choices? Why a text field?

    I was kind of thinking the same thing... There's no js "confirm" equivalent?

  • (cs) in reply to Saint Gerbil
    Saint Gerbil:
    Why type "yes" when you can just hit "y" I've just tripled my productivity.

    No, TRWTF is that the original developer had used the "ReadLine" function instead of using "ReadKey" and continue the processing as soon as someone hit the 'y' key

  • Guy Smiley (unregistered) in reply to bjolling
    bjolling:
    So how would you handle "yeah right!" ?

    I never really understood why "yeah" is affirmative, "right" is affirmative, but "yeah right!" is negative.

    Double positive? Two rights make a wrong, I guess.

  • Cygnus (unregistered) in reply to BlueKnot
    BlueKnot:
    What, no provision for "maybe"?

    That requires fuzzy logic. While the programmer was definitely fuzzy, he was clearly lacking logic.

  • IV (unregistered) in reply to ParkinT
    ParkinT:
    and whether the developer in question really had nothing better to do.
    Nah ...snip... Fer sure Non Don't think so

    Now I am confused. Fer sure doesn't really fit with the theme. Is the result of your comment done by democratic means?

  • (cs) in reply to KiwiGeek
    KiwiGeek:
    This reminds me vagely of the time I was developing a scripting language for a game I was working on and decided to put all the different possible variations of "not" in that I could thing of, including my favourite, "ain't". I like to tell myself that it was the only scripting language to ever have ain't as a keyword. If you're bored, the language functioned something like this... if #var1 not #var2: but "not" could be switched with many different keywords, such as "<>", "!=", "is not", "ain't". "If" could also take many forms, such as "supposing". ... I also had a list of true variables. and False. There was no "FileNotFound", however. ... I was young and foolish.

    Where can I find a definition of this language? I'd like to write programs in it. That would be fun.

  • (cs) in reply to Kermos
    Kermos:
    Ok the first WTF is, if it's a yes/no prompt why not have two buttons? A combo box containing yes/no a choices? Why a text field?
    <input type="button" value="Yes">
    <input type="button" value="No">
    <input type="button" value="Yep">
    <input type="button" value="Nope">
    <input type="button" value="Yeppers">
    <input type="button" value="Yeah">
    <input type="button" value="Yo">
    <input type="button" value="Nah">
    <input type="button" value="Uh huh (nod)">
    <input type="button" value="Uh huh (shake head)">
    <input type="button" value="Alright">
    <input type="button" value="Mmm hmmm">
    <input type="button" value="Ummmm">
    <input type="button" value="Neg">
    
  • pong (unregistered)

    what? no file not found?

  • old-lady (unregistered)

    ...I clicked cancel.

  • Dave (unregistered) in reply to BlueKnot
    BlueKnot:
    What, no provision for "maybe"?
    Hey, they left out FILE_NOT_FOUND as well.
  • Lordy (unregistered) in reply to BlueKnot

    if (answer.equals("maybe")) { return rand(rand(rand(rand({True,False})))); }

  • Loren Pechtel (unregistered) in reply to Volmarias
    Volmarias:
    You've got to wonder the level of boredom required to make such an extensive list, and whether the developer in question really had nothing better to do."

    Boss: Developer! Developer: Yes, boss? Boss: This confirmation prompt is broken! It asks me if I want to proceed, and then doesn't do anything! Developer: Are you pressing Y, or typing yes? Boss: Of course not! I'm typing "yep". Your code should be smart enough to figure that out, and if not, maybe you need another job. Developer: Sigh....

    5 minutes later

    Developer: Ok, it recognizes "yep" Boss: Well it's too bad that you're still an idiot, because it doesn't understand "ok"

    Developer sees where this is going...

    5 minutes later

    Developer: Ok, try again Boss: That's more like it! Ha! It even got "yar"! Excellent job!

    This was almost my thought. I'm thinking some moron up in management rather than the programmer's boss, though.

  • Max (unregistered) in reply to Mee

    I have been trying to think of a counter example for that... and I can't.

    Good work.

  • Max (unregistered) in reply to Kermos

    A part of me is hoping that there ARE two buttons, but they return a text value to the code and, for sylistic reasons, the values of the buttons have changed to something like "YES!" and "No thank you".

  • tbrown (unregistered) in reply to BlueKnot
    BlueKnot:
    What, no provision for "maybe"?

    Nevermind "maybe," hopefully he put in a test for "File not Found!!"

  • (cs) in reply to darkmattar
    darkmattar:
    It's like road rage, except with more semi-colons.

    It sure looks like something I'd do in the above scenario just to be an asshat....

    Being an asshat would involve colons, and in fact probably just one, not semicolons. (I was going to say "full colons", but let's not go there. And not necessarily "regular colons" either.)

  • Mitch (unregistered) in reply to Mee

    Nay

  • VAXcat (unregistered)

    The real WTF is all those statements just to check if the answer was meant to be yes. A substr into a string of all the right answers does it in one statement.

  • Lucio (unregistered) in reply to Mee

    if (answer.equals("eh")) { return true;

    if (answer.equals("neh")) { return false;

    why not take battle school slang?

  • (cs) in reply to Jota

    Jota, I see that scenario all the time. Every time some programmer rails against the stupidity of the previous programmer, I just start playing scenarios like that in mind. I can't tell you how many decent programmers out there have bad reputations simply because the users demanded that they program it that way. That is why it is vital to only attach your name to good code and leave no trace of your identity on bad code.

  • FileNotFound (unregistered) in reply to BlueKnot
    BlueKnot:
    What, no provision for "maybe"?
    The real WTF are all the answers to this question. The correct answer is: Yes, and it returns FileNotFound
  • (cs) in reply to mauve
    mauve:
    brillohead:
    yes, because checking if the memory location of the input is the same as the memory location of my static strings is going to give me exactly the result im looking for...

    True, if you intern the input string: http://java.sun.com/javase/6/docs/api/java/lang/String.html#intern()

    Yet another reason the guys at Sun should stop fucking with the API. Why replace .equals() with something that is exactly the same?

  • (cs) in reply to Jerim
    Jerim:
    Jota, I see that scenario all the time. Every time some programmer rails against the stupidity of the previous programmer, I just start playing scenarios like that in mind. I can't tell you how many decent programmers out there have bad reputations simply because the users demanded that they program it that way. That is why it is vital to only attach your name to good code and leave no trace of your identity on bad code.

    That is no excuse for crappy programming. Just because the users want something, that doesn't mean you can't code it right behind the scenes. The UI may be a mess because they want flashing neon pink buttons, but you don't have to be a retard about how you handle the action performed.

  • SpamBot (unregistered) in reply to IV
    IV:
    ParkinT:
    and whether the developer in question really had nothing better to do.
    Nah ...snip... Fer sure Non Don't think so

    Now I am confused. Fer sure doesn't really fit with the theme. Is the result of your comment done by democratic means?

    That was the sarcasm option.

  • The Drinking Bird (unregistered) in reply to Saint Gerbil
    Saint Gerbil:
    Why type "yes" when you can just hit "y" I've just tripled my productivity.

    This is the last time I'm filling in for you. Once more, and I'll hide your reaching broom!

  • dkallen99 (unregistered) in reply to Kermos
    Kermos:
    KenW:
    The programmer's first mistake. He should have not added anything, but simply checked the first letter for "Y" or "y" and ignored the request.

    Won't work. What if I answer in German? Then it would be "J" or "j" for "Ja".

    Or, what if I answer in Japanese? Now your options for yes are "u" and "h" (un / hai) and your options no are "u" or "i" (uun / iie). And yes as you can see, "u" is ambiguous. Oh and what if I enter my answer in hiragana? Now you need to add う、は、い and you still have the problem with う being ambiguous...=)

    Don't forget "v" for vâng and "k" for không... then there's 是,对,and 不。

    What the heck is a "nisl" ?

  • synp (unregistered) in reply to Jota
    Jota:
    Perhaps this was just a frustrated developer who was tired of dealing with bug reports.

    QA: When I typed "yes" it didn't work. Please fix.

    Developer: OK, "yes" should work the same as "y" now, and "no" should be the same as "n".

    QA: When I typed "ok" it didn't work. That is standard for dialog boxes. The prompt should be more forgiving. Please fix.

    Developer: But this isn't a dialog box... oh, whatever. There, now "ok" and "cancel" should be accepted as well.

    QA: The text on the page before mentions the word "proceed", so the prompt should accept that as well. Please make the prompt more forgiving.

    Developer: Fine. I'll make the prompt more forgiving. You want to type "proceed"? Here, you can type "proceed"! How about "affirmative"? You want "affirmative"? Or maybe "positive"? What about pirates? Aye? Do we have any pirates using our software? Gotta think of the pirates, yep! Hey, "yep" -- you want "yep" too? Have a "yep"! Have whatever you want! Is that forgiving enough? IS THAT FORGIVING ENOUGH?

    QA: When I just hit enter, nothing happens. Hitting enter should default to "yes".

    Developer: <hangs self, and Craig M is hired to replace him>

    Your QA get paid by the bug report too?

  • Crabs (unregistered) in reply to Guy Smiley
    Guy Smiley:
    bjolling:
    So how would you handle "yeah right!" ?

    I never really understood why "yeah" is affirmative, "right" is affirmative, but "yeah right!" is negative.

    Double positive? Two rights make a wrong, I guess.

    Because Yeah Right is almost always sarcastic. Saying it without sarcasm is a positive

Leave a comment on “Are You Sure?”

Log In or post as a guest

Replying to comment #:

« Return to Article