Introduction
The purpose of the project writeup is to document your efforts and to leave
the reader with an understanding of what the code can or does do. You should
write this document at the level of one of your peers; i.e., seniors write
for seniors. Unless otherwise specified, the project writeup contains the
sections outlined below.
The projects will use a literate programming system (LPS) called noweb. The
purpose of this, or any of the other LPSs, is to allow you to intersperse English with code
and to free you from organizational constraints imposed by compilers. Most LPSs
are based on TeX or LaTeX; therefore, mathematics and pictures are easy to
include in your code. You are to read
Norman Ramsey's article. For even more information, see
fibonacci
program. This program, when run through notangle will produce a
compilable file. On the other hand noweave -html fib.nw < fib.html will
produce an html file suitable for viewing.
General Outline
As a general rule, you should present a report containing the following sections.
Documentation Rules for Code
- Each component file must contain the file name, author's name, course number,
and assignment identification. A brief overview of the contents of file is required.
In noweb, the file name is printed in the page header.
- Procedural entities will contain the signature, preconditions,
and postconditions. Each parameter must appear in the pre- and\slash or post-
conditions. The behavior of the procedural body must be described. Preconditions
and postconditions can be described without resorting to mathematics notation. You
are trying to help the reader understand.
- Declarations must be documented as to use. This includes type definitions
as well as variable definitions. In the case of extern definitions,
the comment should include the location of the defining entity.
- Reasonable indentation rules must be used if not using noweb. Reasonable
means that the printed document doesn't have wrap-around lines of code.
- In literate programming, Code is decomposed into ``chunks.'' There are
documentation chunks and code chunks. The metaphor that is suggested is a
``two-paragraph'' model. Code is decomposed into reasonablly sized chunks. Each
such code chunk is preceded by a documentation chunk. Obvious decomposition
rules:
- Large blocks of code that contain local variables.
- while statements. while statements should address the
termination question. The really appropriate way to document a while
statement is with an invariant statement
.
- for statements. fors are just whiles in disguise.
- do statements. Ditto.
- if statements.
- switch statements.
Documentation chunks use proper English and should be related to the specification,
not the code, where practical. The description will normally be in the active
voice.
Bibliography
[1] Norman Ramsey. ``Literate Programming Simplified.'' IEEE Software.
September, 1994. 97-105.