CSC 1351 Chapter : STYLEGUIDE
Document Summary
A program may produce correct outputs for each input, but that has nothing to do with the program being well-designed/coded. Don"t change function-names (parameters and their ordering), local/global variables, and classes given in a program speci ca- tion. Do not use unnecessary assignments (and initializations), if-statements, and unnecessary iterations of loops. If an operation need not be in a loop-body, then move it out of the loop; similarly, for then/else-parts of if-statements. Don"t make up for bad names by adding comments. Begin a function name (other than constructors) with a lower-case letter; printmatrix is shorter and just as readable as print_matrix. Use //-form for comments as much as possible instead of /*-*/ form (it creates problems for nested-comments); keep com- ments short and informative (easier to update as the code changes). Av oid comments that do not correspond to the code. Avoid unnecessary parameters in functions; order them meaningfully.