code-style.md 747 Bytes
Newer Older
Peter van 't Hof's avatar
Peter van 't Hof committed
1
2
# Developer - Code style

Sander van der Zeeuw's avatar
Sander van der Zeeuw committed
3
## General rules
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
- Variable names should always be in *CamelCase* and does **not** start with a capital letter

```scala
// correct: 
val outputFromProgram: String = "foobar"
 
// incorrect:
val OutputFromProgram: String = "foobar"
```

- Class names should always be in *CamelCase* and does **always** start with a capital letter

```scala
// correct:
class ExtractReads {}

// incorrect:
class extractReads {}

```

Sander van der Zeeuw's avatar
Sander van der Zeeuw committed
25
- Avoid using `null`, the Option `type` in Scala can be used instead
26
27
28
29
30
31
32
33
34
35
36

```scala
// correct:
val inputFile: Option[File] = None

// incorrect:
val inputFile: File = null

```
- If a method/value is designed to be overridden make it a `def` and override it with a `def`, we encourage you to not use `val`