Style standards
-
When writing a class, first give the attributes, then the
constructors, and then the methods.
-
Constructors should initialize all attributes of their class.
Constructors with a superclass should begin by calling a constructor
of the superclass.
-
Put only one declaration or statement on a line.
-
Put opening braces at the end of the line and closing braces on a new
line lined up with what they are ending.
-
Indent declarations and statements inside braces to the same level
(something like 2-5 spaces).
-
Use "this" when an object calls one of its own methods.
-
Use descriptive names for methods and attributes.
Do not use the name of the class for methods that are not constructors.
-
Include appropriate comments and blank lines.
At a minimum, provide a comment for each method and attribute.
-
Always use braces to delimit statements controlled by a conditional (if,
else) or loop (for, while).