20210624 Note
The information is preserved for historical purposes. Starting in Fall 2021, we recommend use of the Google Java Code Style with a simpler header at the top of the file given that source control is the accepted approach for tracking changes.
/*
* Author: {user}
* Assignment: {project} - EE333 {Semester}
*
* Credits: (if any for sections of code)
*/
And now, the original content…
Java Documentation Style
Naming Conventions
- Meaningful names (collection of words not letters)
- Use CamelCase not underscores to highlight words
- Start with capital letter in naming classes
- Start with lower case letter in naming methods and variables
- Use all UPPERCASE for constants
- Document class and public methods for JavaDoc automation
(JavaDoc comments should stick to interface details and avoid
discussing implementation details
- Give a one line phrase for each method and instance variable
- Document non-trivial algorithms with a design either in a block or
with code under each part of the design
White Space
- Use blank lines to separate “paragraphs” of code (methods, sections of
code, etc.)
- Use consistent indenting throughout application (4 chars per indent)
- Don’t insert the TAB character into the file
Readability
- Put opening curly brace on line which defines the block
- Put closing curly brace on separate line which lines up with the start
of the statement that created the block
- Don’t have lines greater than 80 characters long (split them up)
- Have an opening header of every file consisting of
/*
*File: FileName.java
*Author: Your name,
*Assignment: Project 2 EE333 Fall 2006
*Vers: 1.0.1 09/01/2006 dgg - fix order of items
*Vers: 1.0.0 09/01/2006 dgg - initial coding
*
*Credits: (if any for sections of code)
*/
Where
- Vers: Version.Revision.Edit
- Change edit every time you print, backup, submit, etc.
- Change revision for changes on release
- Change version when user documentation would have to change.
NetBeans can be configured to help automate the creation of the header file is documented.
Extended Example
For an extended example, see ToDo.java
Last modified: 24 June 2021
David Green .