Coding Conventions
- 1 Naming
- 1.1 Definitions
- 1.1.1 Camel case
- 1.1.2 Pascal case
- 1.1.3 Lowercase
- 1.2 Conventions
- 1.1 Definitions
- 2 White-space
- 2.1 Global rules
- 2.2 In assignments
- 2.3 In expressions
- 3 New lines
Naming
Definitions
Camel case
Each word or abbreviation in the middle of the phrase begins with a capital letter, with no intervening spaces or punctuation.
Example: thisIsAnExample
Pascal case
The same as the camel case with the exception that the first letter is capitalized.
Example: ThisIsAnExample
Lowercase
All letters are lowercase, with no intervening spaces or punctuation.
Example: thisisanexample
Conventions
Language construction | Style |
---|---|
Variable name | Camel case |
FETCH column aliases | Camel case |
Type names | Lowercase |
Type variables | Camel case |
Method and Function names | Camel case |
Method and Function parameter names | Camel case |
Import aliases | Camel case |
Workflow names | Pascal case |
White-space
A single white-space should be put before and after punctuation or symbols.
Global rules
No white-space before semicolon (;)
No white-space before or after function call operator (→)
No white-space before or after parenthesis
In assignments
White-space should be added before and after the equals (=) symbol.
Correct
var a = "test";
Incorrect
//No space before or after
var a= "test";
var a="test";
var a ="test";
In expressions
White-space should be added before and after operators.
Correct
var a = (1 + 1) * 2;
if (a > 10 or a < 10) return 0;
Incorrect
New lines
No new lines should be added before open curly braces.
Close curly brace should always be on new lines and should be followed by new line.
Two consecutive new lines are forbidden.
If-else statement
Correct
Incorrect
FETCH expression
Depending on the size of your FETCH expression you have more choices.
Short single entity FETCH expressions should be written on the same line as the variable declaration. If the length of the variable declaration, assignment and FETCH expression exceeds 80 characters the variable declaration and assignment should be on one line and the FETCH expression on a new line with a single indentation.
Multiple entity FETCH expression should always be broken in multiple lines.
Methods or Functions
Methods and Functions should have new lines before and after