When we develop real functions, we are often confronted with the task of designing a
data representation for complicated forms of information. The best strategy to
approach this task is apply a well-known scientific technique: <#63861#><#18862#>ITERATIVE REFINEMENT.<#18862#><#63861#> A scientist's problem is to represent a part of the real world using
mathematics. The result of the effort is called a <#63862#><#18863#>MODEL<#18863#><#63862#>. The scientist
then tests the model in many ways, in particular by predicting certain properties
of events. If the model truly captured the essential elements of the real world,
the prediction will be accurate; otherwise, there will be discrepancies between the
predictions and the actual outcomes. For example, a physicist may start by
representing a jet plane as a point and by predicting its movement in a straight
line using Newton's equations. Later, if there is a need to understand the plane's
friction, the physicist may add certain aspects of the jet plane's contour to the
model. In general, a scientist refines a model and re-test its usefulness until it
is sufficiently accurate.
A programmer or a computing scientist should proceed like a scientist. Since the
representation of data plays a central role in the work of a programmer, the key is
to find an accurate data representation of the real-world information. The best way
to get there in complicated situations is to develop the representation in an
iterative manner, starting with the essential elements and adding more attributes
when the current model is fully understood.
In this book, we have encountered iterative refinement in many of our extended
exercises. For example, the exercise on moving pictures started with simple circles
and rectangles; later on we developed programs for moving entire lists of shapes.
Similarly, we first introduced Web pages as a list of words and embedded Web pages;
in section~#secmorewp#18864> we refined the representation of embedded Web pages.
For all of these exercises, however, the refinement was built into the
presentation.
This section illustrates iterative refinement as a principle of program
development. The goal is to model a file system. A file system is that
part of the computer that remembers programs and data when the computer is
turned off. We first discuss files in more details and then iteratively
develop three data representations. The last part of the section suggests
some programming exercises for the final model. We will use iterative
refinement again in later sections