There is such a thing as defensive coding.
i.e. Parsing a config file.
This will function fine (modulo bugs...the above is just typed). It will continue to function fine if you remove the w/s stripping lines and the set of test data doesn't contain any lines consisting of only w/s.while( <FILE> ) { s/#.*$//; # Lose comments s/^\s*//; # Lose leading w/s s/\s*$//; # Lose trailing w/s next unless $_; ... do stuff }
However, if you do that and then someone adds a line containing w/s to the config file then it will barf. Of course, if your environment defines that failure in that case is acceptable since that is not a legal line in the config file then you have done nothing wrong.
IMHO, a (small, controllable) bit of over-engineering is OK, if done sensibly.
Then again, there are always cases where this would be the wrong thing to do. So shucks, its not a universal rule.
In reply to Re: Over Programming
by jbert
in thread Over Programming
by little_mistress
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |