|
Unix Programming - Basics of the Unix Philosophy - Rule of Transparency: Design for visibility to make
Rule of Transparency: Design for visibility to make
inspection and debugging easier.
Because debugging often occupies three-quarters or more of
development time, work done early to ease debugging can be a very
good investment. A particularly effective way to ease debugging is to
design for
transparency
and
discoverability
.
A software system is
transparent
when you
can look at it and immediately understand what it is doing and how. It
is
discoverable
when it has facilities for
monitoring and display of internal state so that your program not only
functions well but can be
seen
to function
well.
Designing for these qualities will have implications throughout
a project. At minimum, it implies that debugging options should not be
minimal afterthoughts. Rather, they should be designed in from the
beginning — from the point of view that the program should be
able to both demonstrate its own correctness and communicate to future
developers the original developer's mental model of the problem it
solves.
For a program to demonstrate its own correctness, it needs to be
using input and output formats sufficiently simple so that the proper
relationship between valid input and correct output is easy to
check.
The objective of designing for transparency and discoverability
should also encourage simple interfaces that can easily be manipulated
by other programs — in particular, test and monitoring harnesses
and debugging scripts.
[an error occurred while processing this directive]
|