|Program Style Guide||
1.1 Use meaningful names.
1.2 Class names start with a capital letter.
1.3 Class names are singular nouns.
1.4 Method and variable names start with lowercase letters.
1.5 Constants are written in UPPERCASE.
2.1 One level of indentation is four spaces.
2.2 All statements within a block are indented one level.
2.3 Braces for classes and methods are alone on one line.
2.4 For all other blocks, braces open at the end of a line.
2.5 Always use braces in control structures
2.6 Use a space before the opening brace of a control structure's block.
2.7 Use a space around operators.
3.1 Every class has a class comment at the top.
3.2 Every method has a method comment.
3.3 Comments are Javadoc-readable.
3.4 Code comments (only) where necessary.
|4. Language use restrictions|
4.1 Order of declarations: fields, constructors, methods.
4.2 Fields may not be public (except for final fields).
4.3 Always use an access modifier.
4.4 Import classes separately.
4.5 Always include a constructor (even if the body is empty).
4.6 Always include superclass constructor call.
4.7 Initialise all fields in the constructor.
|5. Code idioms|
5.1 Use iterators with collections.
Copyright (c) Michael Kölling and David Barnes.
This style guide was written for the book Objects First With Java - A Practical Introduction Using BlueJ.
Permission is granted to everyone to copy, modify and distribute this document or derived documents in any way. We would appreciate a reference to the original source in derived documents.