Project Standards - SWE-574-Spring-2018/LinkyWay GitHub Wiki
Code Conventions
Java Code Convention document by Oracle is used as a base.
- Files
- Lines in a file should not exceed 2000 lines.
- Line length must not exceed 80 characters.
- First letter of words in a file name must be uppercase, other letters must be lowercase.
'e.g. HeaderController.java'
- Comments
- Implementation comments must be written using
/*...*/
. - Documentation comments must be written using
/**...*/
. - Documentation comments must include parameters description if present in the method.
{@link package.class#member label}
. - Documentation comments must include the link of the mentioned object (class or variable).
- Implementation comments must be written using
- Code Formatting
- Four spaces should be used as the unit of indentation.
- Each line should contain at most one statement.
- One declaration per line is recommended.
- Put declarations only at the beginning of blocks.
- Methods are separated by a blank line.
- Two blank lines should always be used in the following circumstances:
- Between sections of a source file
- Between class and interface definitions
- One blank line should always be used in the following circumstances:
- Between methods
- Between the local variables in a method and its first statement
- Before a block
- Naming Conventions:
- Constant variable names must be all uppercase and divided by '_'
e.g. TIMEOUT_DURATION
. - Constant variables must be at the top of the class block.
- Methods should be verbs
e.g. processUserList()
. - Variables must start with a lowercase first letter and internal words start with capital letters
e.g. userName
. - One-character variable names should be avoided except for temporary “throwaway” variables
e.g. variables used for 'for' statements
.
- Constant variable names must be all uppercase and divided by '_'
A block is any code surrounded by curly braces “{” and “}”.
Implementation comments are mean for commenting out code or for comments about the particular implementation. Doc comments are meant to describe the specification of the code.
Code can be formatted by using the default format mechanism (Ctrl + Alt + L) of the editors based on IntelliJ.
Lint tools provided by the editor must be used before any release to create better builds with more standardized code!
Issue Management Policy
- Each development task (issue) will have a unique identifier value. For example, a backend implementation task can have id BE-101. T