|
Unix Programming - Basics of the Unix Philosophy - Rule of Robustness: Robustness is the child oftransparency and simplicity.
Rule of Robustness: Robustness is the child oftransparency and simplicity.
Software is said to be robust when
it performs well under unexpected conditions which stress the designer's
assumptions, as well as under normal conditions.
Most software is fragile and buggy because most programs are too
complicated for a human brain to understand all at once. When you
can't reason correctly about the guts of a program, you can't be sure
it's correct, and you can't fix it if it's broken.
It follows that the way to make robust programs is to make their
internals easy for human beings to reason about. There are two main
ways to do that:
transparency and
simplicity.
|
For robustness, designing in tolerance for unusual or extremely
bulky inputs is also important. Bearing in mind the Rule of
Composition helps; input generated by other programs is notorious for
stress-testing software (e.g.,the original Unix C compiler reportedly
needed small upgrades to cope well with Yacc output). The forms
involved often seem useless to humans. For example, accepting empty
lists/strings/etc., even in places where a human would seldom or never
supply an empty string, avoids having to special-case such situations when
generating the input mechanically.
|
|
| --
Henry Spencer
|
|
One very important tactic for being robust under odd inputs is
to avoid having special cases in your code. Bugs often lurk in the
code for handling special cases, and in the interactions among parts
of the code intended to handle different special cases.
We observed above that software is
transparent when you can look at it and
immediately see what is going on. It is
simple
when what is going on is uncomplicated enough for a human brain to
reason about all the potential cases without strain. The more
your programs have both of these qualities, the more robust they will
be.
Modularity (simple parts, clean interfaces) is a way to organize
programs to make them simpler. There are other ways to fight for
simplicity. Here's another one.
[an error occurred while processing this directive]
|