CS1121 Program Style Guidelines

All comments in your program must be professional. Obscenities, flames, slurs, slanders are not professional. Remember, somebody is looking at your code and your comments when they grade your program.


Every program should begin with a javadoc comment containing a short description of what the program does, your name, the class (CS1121), the semester (Fall 2007), the date the program was written, your recitation section number and your lab section number. Here is an example:


Every class must have a javadoc comment indicating what the class does. The comment must be correct English sentences. Here is an example:


Every method must have a javadoc comment describing what it does, and a list of parameters, what they mean, and any constraints on their values (e.g., must be a positive integer), and a description of what the method returns (if it does return anything). Here is an example:


All in-line comments (amongst the commands) must have a blank line before and should be indented the same amount as the code they apply to.


Your code must be indented properly. Remember, you can get Eclipse to indent your code for you by typing: ctrl-a followed by ctrl-i.


All class names must have the first letter capitalized (e.g. Scene). All method and variable names must have the first letter uncapitalized (e.g., draw). All names that are multiple words (e.g., fillOval) must have the first letter of each word capitalized, except the first letter as noted above for method and variable names.

Example class names: Scene, MyFavoriteAnimation
Example method/variable names: draw, fillOval, doSomething, treeHeight


You must use named constants for fixed positions, sizes, etc. Do not bury literals in the code. For example, use:

where sunLeft, sunTop and sunDiameter are named constants, and NOT


All instance variables must be private.