PROGRAMMING GUIDELINES FOR ALL PROJECTS
Program Headers - Each source code file you submit as part of a
programming project must contain the following information at the
beginning of the file, in a comment block:
1. your name;
2. course number and section number, if applicable;
3. assignment name and number (e.g. Project 1);
4. instructor's name;
5. a short description of the file's purpose and what it does.
Method/Function Headers - each method/function/subroutine must be preceded
by a comment block containing the following information:
1. a description of what the method/function/subroutine does;
2. a description of each parameter, provided the parameter is not
self-explanatory;
3. a description of the return value, if any;
4. preconditions and postconditions may be included, if you so
desire.
Commenting your code - you must include comments in your code that
describe it and the variables you are using as follows:
1. every variable that is not self-explanatory must be commented;
2. your code must be commented, especially in obscure areas, but
don't go over the top;
3. variables should have meaningful names.
Program Structure -
1. indent your code 2-4 spaces, consistently after curly braces,
logic flow changes, try-catch blocks, etc.;
2. do not use goto statements unless absolutely necessary;
3. programs should be divided into modules and classes (when
using an object-oriented language), and such modules should not be too
long. If you have to scroll down really far to view an entire method,
it is probably too long.
Input and Output (I/O) -
1. prompting and output should be used only when useful;
2. many students find it useful to include a debug print switch
(boolean variable) in their code -- this allows them to turn off
unnecessary debug output before submitting an assignment;
3. output should be arranged in an easy-to-read format such as in
blocks, rows, columns, etc.;
4. do not include debug output unless it is specifically required
in the specification.