afternoon and what the date is.
Humans demand even more from programs. This audience consists of two main groups, whose goals
can conflict. The larger of the two groups consists of users. Users care about how the program presents
itself, its user interface, and how quickly the program runs, how efficient it is. To satisfy this audience,
programmers may use statements that are overly terse because they know how to make the program more
readable by the computer’s compiler, enabling the compiler to produce faster, but less human-intelligible
program. This approach causes the other portion of the audience
programmers to boo and hiss. The
smaller audience, of which you are also a member, must be able to read the program so that they can
enhance and/or change it. A characteristic of programs, which further distinguishes it from prose, is
that you and others will seek to modify your program in the future. For example, in the 1960s when
the first version of Fortran was created, useful programs by today’s standards (such as matrix inversion)
were written. Back then, the user interface possibilities were quite limited, and the use of visual displays
was limited. Thirty years later, you would (conceivably) want to take an old program, and provide a
modern user interface. If the program is structurally sound (a good outline and organized well) and is
well-written, re-using the “good” portions is easy accomplished.
The three-audience situation has prompted most languages to support both computer-oriented and
human-oriented “prose”. The program’s meaning is conveyed by statements, and is what the computer
interprets. Humans read this part, which in virtually all languages bears a strong relationship to mathe-
matical equations, and also read comments. Comments are not read by the computer at all, but are there
to help explain what might be expressed in a complicated way by programming language syntax. The
document or program you write today should be understandable tomorrow, not only by you, but also by
others. Sentences and paragraphs should make sense after a day or so of gestation. Paragraphs and larger
conceptual units should not make assumptions or leaps that confuse the reader. Otherwise, the document
you write for yourself or others served no purpose. The same is true with programming; the program’s
organizationshould be easy to follow and the way you write the program, using both statements and com-
ments, should help you and others understand how the computation proceeds. The existence of comments
permits the writer to directly express the program’s outline in the program to help the reader comprehend
the computation.
These similarities highlightthe parallels between composition and programming. Differencesbecome
evident because programming is, in many ways, more demanding than prose writing. On one hand, the
components and structure of programming languages are far simpler than the grammar and syntax of any
verbal or written language. When reading a document, you can figure out the misspelled words, and not
be bothered about every little imprecision in interpreting what is written. On the other, simple errors, akin
to misspelled words or unclear antecedents, can completely obviate a program, rendering it senseless or
causing it to go wildly wrong during execution. For example, there is no real dictionary when it comes
to programming. You can define variable names containing virtually any combination of letters (upper
and lower case), underscores, and numbers. A typographical error in a variable’s name can therefore
lead to unpredictable program behavior. Furthermore, computer execution speeds are becoming faster
and faster, meaning that increasingly complex programs can run very quickly. For example, the program
(actually groups of programs) that run NASA’s space shuttle might be comparable in size to Hugo’s Les
Mis
´
erables, but its complexity and immediate importance to the “user” far exceeds that of the novel.
As a consequence, program design must be extremely structured, having the ultimate intentions of
performing a specific calculation efficiently with attractive, understandable, efficient programs. Achiev-
ing these general goals means breaking the program into components, writing and testing them separately,
then merging them according to the outline. Toward this end, we stress modular programming. Modules
can be on the scale of chapters or paragraphs, and share many of the same features. They consist of a se-
quence of statements that by themselves express a meaningful computation. They can be merged to form
larger programs by specifying what they do and how they interface to other packages of software. The
analogy in prose is agreeing on the character’s names and what events are to happen in each paragraph
so that events happen to the right people in the right sequence once the whole is formed. Modules can be
re-used in two ways. As with our program from the 1960s, we would “lift” the matrix inversion routine
and put a different user interface around it. We can also re-use a routine within a program several times.
For example, solving the equations of space flight involves the inversion of many matrices. We would
c
2001 J.E. Akin 2