CS 1320 (Principles of Algorithm Design I):
Guidelines for Programming Assignments

What to turn in

Be sure your name and the assignment number appear on everything you turn in.

Grading criteria

Tips for writing good documentation and "clear code"

Something that early programmers did not fully appreciate is that programs tend to take on a life of their own, being reused and modified over a period of years, often by people other than their original authors. The better a job the original author did of documenting the program and writing it clearly, the easier it will be to reuse and modify. The sample programs are examples of what I consider reasonable documentation and clear code.

Documentation

By "documentation" I mean comments at the start of the program that help potential users understand exactly what the program does without necessarily understanding how, and definitely without reading the whole program. As an example of the distinction between what and how, notice that the documentation for the sample program quadratic describes only the input (sets of coefficients for quadratic equations) and output (roots of the corresponding equations) without explaining how these roots are computed. If we later found a better method of computing the roots, we could replace some of the body of the program without altering the documentation.

Clear code

The object of these suggestions is to make the code clear and readable for the human reader, perhaps a programmer who wants to reuse it with modifications. Here are some tips for writing clear code.