0

Imagine that you made a program that accepts userinput in this format:

cmd.exe
or
netscape.exe

this is a good input and the program accepts it, but what if the user enters this:

cmd
or
netscape

Must the programmer Flag this as an error and allow the user to correct his input or
make the program correct it for the user.

2
Contributors
1
Reply
2
Views
12 Years
Discussion Span
Last Post by Narue
0

>Must the programmer Flag this as an error and allow the user to correct
>his input or make the program correct it for the user
That's up to the programmer. It's certainly easier in the general case to force absolute correctness from the end user, but the added convenience of omitting information that won't change can be the deciding factor in whether your software is used or not. However, adding a "fudge factor" into the input processing isn't always as simple as tacking on ".exe" if it's not there.

Most likely you would end up doing a search of the relative directory to see if the program is there, and then doing a search of your environment variables, and for good measure you might even want to do an approximate search to account for typos, which is considerably more complicated than an exact search. Once you find some matches, you'll then need to ask the user if that's what they really meant, and if there are more than one, which of those options, if any, were wanted, and get a response. All of this could actually take more time than simply asking for correct input to begin with.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.