CSC 1351 Chapter : STYLEGUIDE

10 views1 pages
15 Mar 2019
School
Course
Professor

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.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents