GUIDELINES
FOR
WRITING CODE
1)
Always
include a program header comment on top of your program. It should include: · Programmer’s name.
·
Course
information.
·
Assignment due date.
·
Assignment number.
·
Program file path.
·
Problem definition.
2) Choose easy
to understand names (variables, constants, and functions) and enhance their
meaning with appropriate comments.
int
min1; //
Number of minutes in the first input time
3) Use blank lines
and spaces to make your code more readable. Also place blank lines between
groups of related statements.
4) Include
comments for sub—task (groups of statements), and when needed, for
individual statements to make your code more understandable (assume someone
who does not know about your assignment is trying to understand it).
5) Don’t be
satisfied with just making your program work. See if you can make it simpler
and better (simpler NOT EQUAL TO shorter).
6) Save and
compile your code frequently. Don’t wait until all the code has been
entered.
7) Use
indentation every time a program block starts.
{
8) Place a header
comment that includes the following before each function definition
(implementation):
·
Function name.
·
Input
description.
·
Output
description.
·
Function task. |