Some Elements of
Style
Assignment Submissions
Place both code and output in a Word
document
Type the
following in comment lines at the top of your code:
Line 1: Name
Line 2: Date
Line 3: Lab Number
Always include the code first,
followed by a screen capture of relevant output
If assignments are more than 1 page,
staple them.
Unless told otherwise, submit parts of
assignments separately and labeled appropriately
(part a, part
b, etc).
General
Place all import, implements and
includes statements immediately after the
comments
described above.
Next, place all global variables, but
see next bullet.
Avoid global variables.
The main method should be as short as
possible.
Use short and meaningful names for
functions (C++), methods (java), classes, structs
(C++), sub and
function procedures (Visual Basic) and variables.
Capitalize the first letter of each
word when using compound words.
Use all caps for constants.
Indent sections of code.
Align braces and place each on a
separate line and column.
Use white space appropriately in order
to facilitate reading.
Use parentheses to force precedence -
omit needless ones.
Consolidate input and output
statements.