Re: Python or Perl for a Debian maintainance project?
>>>>> "Steve" == Steve Greenland <firstname.lastname@example.org> writes:
>> I don't quite agree with even this claim. Usually leaving errors
>> unhandled (and crash the program right away) is better, simply
>> because there will be less code to maintain.
Steve> Yeah, it's *much* better to crash, lose all the information I've
Steve> entered in this session, leave a pile of temporary files around
Steve> that I'll have to hunt down and kill, and print a stack dump to
Steve> some buried log file, rather than to catch the error and give me
Steve> a chance to work around it.
For most programs, when they crash, the user cannot get the service provided
by that program, and period. To write programs that need to deal with the
users entering "a lot of information", it is much better to code it so that
periodically a "crash-box" file is saved, so that users can restart at a
point not too far from the point of crash, rather than trying to catch every
corner cases of exceptional conditions---which is, at best, not typically
done perfectly. Of course, "expected" exceptional conditions should be
handled nicely. But it shouldn't be necessary to extend this virtue to
cover every possible exceptional conditions.
Also, it is easier for the program to clean up its mess the next time it is
started than when the crash (or exceptional condition) occurs. And there is
really no reason why the stack dump must be buried in log files rather than
just dump in the face of the user. It is an event that the programmer
doesn't envision, let's admit that the program is not perfect.
>> Not every user will feel it better, but many will once they
>> understand the consequence.
Steve> What consequence? Not having their work lost and time wasted
Steve> because you were too lazy to do things correctly?
Consequences include that features that they requests and bugs they find
will arrive much later, patches can be written and tested for security holes
only days after the hole is found and being actively exploited, etc. All
computer users expect programs can crash occasionally, and take necessary
guard against them. No rational user will rely on the program never to
crash---It is always possible that the programmer makes a small mistake,
which leaves the program in a completely inconsistent state. Thus I
conclude that it is irrational to require ourselves to write "the perfect
program", when only a few person strongly request for it (and even those
understand that it is in practice impossible); at the expense that the
development must become sluggish, and cause trouble to every user of your
Steve> Sloppy wannabe, then.
Call me whatever you want, I don't argue about terminology. If you want to
say essentially every programmer who write general-purpose programs are
"sloppy wannabe", I won't interfere any bit. I echo Larry Wall's (Perl
author) saying that the three virtues of programmers are Laziness,
Impatience and Hubris.