aboutsummaryrefslogtreecommitdiff
path: root/conventions.md
blob: 875292fb52c706947744548f78e8f9083e58471e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Coding conventions
==================

This document contains some syntactic and code format conventions for the current project and should be used as a
reference to enhance code uniformity.


Formatting
----------

Sources are formatted as defined in the `EPFL-PPO.xml` Eclipse format file.


Members ordering
----------------

Class (static) members are placed before object members. In each group, attributes are placed before methods.
Constructors are the first methods, and overridden parent methods the last ones.


Object/Class reference
----------------------

Methods and attributes are referenced using `this` for the current class, and by their class name for static
ones.

Static imports are avoided, except for JUnit tests.


Redundant type/scope
--------------------

Use of the diamond notation is encouraged to avoid redundancy.

Unnecessary scope modifiers are avoided (ex: `public` in interfaces). 


Unnecessary brackets
--------------------

Unnecessary brackets in one to two line statements are avoided to simplify the reading of the control flow.