CS 1711 2003 Program Style Guide | Version 1.0
|
1. Naming |
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. Layout |
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. Documentation |
3.1 Every class has a class comment at the top.
|
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 Notice Modified, as permitted, from the BlueJ programming style guide, copyright by Michael Kölling and David Barnes, written for the book Objects First With Java - A Practical Introduction Using BlueJ. |