Style standards

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