Risk Project Code Convention - san089/SOEN_6441 GitHub Wiki
This document serves as the complete definition of Risk Project coding standards for source code in the Java™ Programming Language.
This standards will not cover everything of Java Programming. We set three basic rules: layout, naming and comment, to increase code readability/understandability.
1. Layout
1.1 BLock Indentation: +4 spaces
Each time a new block or block-like construct is opened, the indent increases by two spaces. When the block ends, the indent returns to the previous indent level. The indent level applies to both code and comments throughout the block.
2. Naming
2.1 File Name
File names use: ModelClass.java
2.2 Package Name
Package names are all lowercase, with consecutive words simply concatenated together (no underscores). For example: modelpackage, not Model or MODEL.
2.3 Class Name
Class names are written in ModelClass.
2.4 Method Name
Method names are written in getRiskData(localArgs){ }
2.5 Constants Name
Constant names use CONSTENT_DATA.
2.6 Local Variable
Local variable names use localVriable.
2.7 Global variable:
Global variable names use RISKdata.
2.8 Data Member
Data Member names use dataMember.
3. Comments
3.1 Javadoc Formatting
For class:
/**
* Define class of ...
* Something..
*/
For method:
/**
* The function of this method is ...
* @Parameters Blablabla
* @return Blablabla
*/
When the meaning of the code by itself is not completely obvious and unambiguous. Use “ // explanation” format.
//explanation
private int numOfArmies