Skip to content

Coding style guidelines

kvosper edited this page Mar 2, 2018 · 7 revisions

This document is a work-in-progress and as such does not contain a complete list of guidelines, nor are they in any order. Some of them may need further clarification.

  • We use static imports wherever reasonable. We consider it reasonable when the signature of the method is sufficiently descriptive by itself (e.g. java.nio.file.Files.readAllBytes), but make exceptions when it is very vague (e.g. java.nio.file.Paths.get).

  • We do not use the asterisk import (e.g. import static foo.bar.*). This is to avoid writing misleading or confusing code.

  • A unit test should make sense when read in isolation. As such, any values that are going to be tested in the assertions should be kept literal. Furthermore these same values should appear in the set-up of the test (referring to the top of the test method, not the general 'setUp' method that sometimes appears in test classes).

  • We DO NOT yet have a convention for how to make code (particularly test code) multiplatform without creating clutter when dealing with paths or new-line characters. This needs to be decided.

Clone this wiki locally