Programming Standards
Programs will be written in MATLAB, C, and Fortran.
Both graphical or other output and source code should be turned
in with each assignment.
Documentation of Source Code
-
All program units (main program, subroutines, functions,...) should begin with
a header describing
- the purpose of the program (the calculations to be performed) and
- the inputs and outputs of the program.
The Fortran subroutine CG.f and
the Matlab function cg.m are two examples
of how a a program should look like.
-
Sufficient comments should be provided within the body of the
source code that a reader can follow the structure of the computation.
Avoid redundant comments, where the code itself is just as
informative. For example,
% y = C e
y = C.*e
simply clutters up the code, whereas
% Hooke's Law
y = C.*e
is useful.
-
Loops should be indented for readability. Which indentation
convention you use (2 spaces, 3 spaces, tab,...) doesn't matter -
consistency does.
Graphics
-
Captions should be provided which clearly identify the significance
of the plots. Too much information is MUCH better than not enough.
-
Axes should be clearly labeled, with units if relevant.
-
Multiple lines on the same plot should be distinguished, eg. by
use of different line types with the significance of each explained
in the caption.