Every programming department has some set of standards or conventions that programmers are expected to follow. The purpose of these standards is make programs readable and maintainable. After all, you may be the programmer who maintains your own code more than six months after having written the original. While no two programming departments standards/conventions may be the same, it is important that all members of the department follow the same standards. Neatness counts!!!
Part of every assignment grade is based upon how well these standards are followed.
It is your responsibility to understand these standards. If you have any questions, ask your instructor!
2-"word" variable name: grandTotal
or
grand_total
2-"word" function name: ProcessError
or
Process_Error
The prudent use of whitespace (blank lines as well as space) goes a long way to making your program readable.
x = y + 5;
NOT x=y+5;
Comments are the programmers main source of documentation. Comments for files, functions and code are described below.
EVERY project file should contain an opening comment describing the contents of the file and other pertinent information. This "file header comment" MUST include the following information.
/** * @Author George Burdell (gburdell@umbc.edu) * This file contains a program that gets two numbers from the * user and displays some statistics about the numbers. */
EACH FUNCTION must have a header comment that includes the following:
/** * area() - Calculate the area of a circle with the specified radius. * * @radius: measured in inches * Return: circle's area, measured in square inches */
The astute reader will recognize this as the Linux kernel commenting style. See the Linux commenting guide.