CS 117: Introduction to Computer Science
Java Programming Style

1. Line up braces. You'll find that the textbook tends to use method (a), whereas I tend to use method (b). Either method is equally acceptable -- pick one and stick with it.
 
 
Method (a) Method (b)
if (a == b)
{
    c = d;
    e = f;
}
if (a == b) {
    c = d;
    e = f;
}

2. Use whitespace in a meaningful way to make your code readable:

3. Use capitalization to make your identifiers clear:


4. Keep your methods short. A method shouldn't be longer than 1-2 screens without good reasons.

5. Each class should contain header documentation containing:

    Use Javadoc where appropriate.

6. Every method should contain header documentation containing

    Use Javadoc where appropriate.