Link Search Menu Expand Document

Style Notes

CSE 143

Table of contents
  1. Formatting
  2. Commenting Language
  3. Naming
  4. Variable and Field Guidelines
  5. Miscellaneous
  6. References


  • Include a header comment with your name, section, TA, and brief description of program functionality.
  • Use pre/post format. Pre: represents parameter specifications and requirements with exceptions noted; Post: represents method return or output functionality.
  • No more than 80 characters per line.

Commenting Language

  • Say what the method does directly (“calculates a sum” instead of “this method calculates…”).
  • Write in a client-oriented manner. Avoid mentioning local variable names, private field names, loops, recursion, etc. - these concern how the program works.
  • Explicitly write the inputs (parameters) and outputs (output or return) for a method.


Variable TypeFormattingExample

Variable and Field Guidelines

  • Fields should always be private unless stated otherwise.
  • Class constants can be public.
  • Avoid static global variables.
  • Always declare fields above their constructor, but do not initialize outside of constructor. Instead, initialize fields inside the constructor.


  • Adhere by Boolean zen.
  • Make helper methods private.