Page History
...
Warning |
---|
This Style guide is unofficial as of yet. Please see the Code Contribution Guidelines page for our old code style recommendations, which are still currently in effect. |
Table of Contents |
---|
Existing DSpace Java Style Guide
Per the Code Contribution Guidelines page (see "Coding Conventions" section), our existing style guide is listed as follows:
...
Because the Sun Java style guide is no longer maintained, it will not be keeping up with current Java style best practices, features, etc. We should consider whether we continue to base our style off this outdated guide, use a more modern guide, or develop our own guide.
Proposed DSpace Java Style Guide (work-in-progress - not yet approved)
Bolded rules are a change from our current Style Guide.
- 4-space indents for Java, and 2-space indents for XML. NO TABS ALLOWED.
K&R style braces
Code Block if (code) { // code } else { // code }
- Do not use wildcard imports (e.g.
import java.util.*
) - Write Javadocs for public methods and classes.
...
- Keep it short and to the point
- (UNDER DISCUSSION) Javadoc
@author
tags are optional, but should refer to an individual's name or handle (e.g. GitHub username) when included?
- (UNDER DISCUSSION) Javadoc
Maximum length of lines is 120 characters.
- UTF-8 encoding is required
Each source file must contain the required license header, e.g.
Code Block /** * The contents of this file are subject to the license and copyright * detailed in the LICENSE and NOTICE files at the root of the source * tree and available online at * * http://www.dspace.org/license/ */
Other
...
Java Style Guides
Google Java Style Guide
The Google Java Style Guide is at https://google.github.io/styleguide/javaguide.html
...