On 9/21/11 1:48 PM, Fred Cisin wrote:
Too many people never seem to learn that a program
that works is NOT
"correct" unless it would also work with bad inputs or other conditions.
"Your program worked! That's a very good START. Now, what happens if the
user types in 0 for the input value? What happens if the user types in
"NO" instead of a number? What happens if the user puts a space in the
middle of the name that they are supposed to type in?"
Several years ago I wrote a very simple interactive shell script[1]
that set up a class environment from a CD, on a fresh Linux install.
The OS version was fixed and the installation was automated, so no
variables there. The operators expected to run the script had a minimum
level of Linux skills. They also had access to a central help desk.
The initial script, which accepted input where needed and resulted in
a complete, correct setup, was about 75 lines. The delivered script was
over 800 lines, about half comments and half error-checking. It was
about the most heinous work of art I ever delivered.
Doc
[1] bash was not the most efficient way to do it, but it was the most
universally accessible. The client wanted something internally
documented and easily maintained and expanded.