Some Style Guidelines:
- Put curly braces on lines by themselves and line them up
- I don't care what order your methods are in (i.e. they
don't have to be in alphabetical order
- Comments should explain why you are doing what you are
doing
- When writing catch blocks, the variable names should use
the letters of the particular exception they are trying to catch
- (i.e. catch
(ArithmeticException ae)
- Variable names should be meaningful which means they should
remind you of what values they are holding
- All code should have a javadoc heading /** this code ..
- All code should have @author and @version/date
- It's a good idea to version your code when you are
debugging it. (i.e. when you are trying to fix an error,
- rename the class X as class X1 and save it as classX1.java . In case you need to go back to previous version it will
still be there.
- Use white space to make your code readable
- Shorten code and comment lines so they don't wrap around
when you print them. A good way to
do this with output statements is to have the System.out.println on a separate line from the (" output text ");
- Each method should have only one return
statement. If you have several
places where the return value can be set, use a temporary variable in each
of those places and return that variable in your return statement.
- Use // end
main
and // end class and //
end xxx at the end of each code block as
appropriate to remind you what you
are ending
- Use this. when referring to
class variables even when not required
- Indent with spaces instead of tabs to keep your lines from
getting too long to print out on a single line. Using jGrasp's
CSD is helpful in debugging and looking at your code but may indent too
far to print on a single line.
-