Java Coding Conventions - Texera/texera GitHub Wiki
Author: Zuozhi Wang
This document specifies the coding conventions in Texera project.
- Use spaces instead of tabs. Configure your IDE or text editor to use 4 spaces instead of tabs.
In Eclipse
In IntelliJ, uncheckuse tab character
.
The reason is that Github shows tab as 8 spaces, thus leading to inconsistency of indentations. Different people may have different configurations, which may mess up the space / tab and show a lot of changes in git diff.
-
Use camel case, e.g.
SampleClass
,sampleVariable
For constants, use all upper case with underscores, e.g.SAMPLE_CONSTANT
-
Use the following indentation style
/**
* Don't forget to write JavaDoc comments.
*/
public void sampleFunction(int x) {
// leave one space before bracket {
if (x > 0) {
doSomething();
} else {
doSomethingElse();
}
}