This document describes the development guidelines when writing and maintaining EnMasse source code.
As EnMasse is a polyglot project with multiple languages in the same repo, it uses make
as a
single entry point for invoking a full project build. Make will invoke the language-specific build
single entry point for invoking a full project build. Make will invoke the language-specific build
system.
If you need a function or class utility that requires adding a new dependency, first consider:
- If the dependency has a reliable release schedule and track record for security updates.
- If the dependency pulls in transitive dependencies that increase the footprint significantly
- If you can copy the function or class (assuming the license allows it) into the EnMasse source tree. This should only be done for trivial amounts of code where the maintenance cost is expected to be low.
- If the cost of implementing and maintaining the functionality yourself is worthwhile in the same manner as above.
Java source code is built using Maven.
Source code should follow the Google Java Style Guide with the following amendments:
- Use 4 spaces indentation
- Newlines should be used between annotations and function/class definitions
Prefer to use plain Java whenever you can. Code should be easy to understand without intimate knowledge of specific frameworks. VertX, Jackson, JAX-RS and tests framework annotations such as Junit are in use at present, and should be preferred instead of introducing other frameworks. However, some dependencies like Eclipse Hono uses Spring, in which case it cannot be ignored.
Golang dependencies are managed using go modules
Use gofmt
to format all the source code.
JavaScript dependencies are managed using npm
, but it is invoked using maven and the
frontend-maven-plugin
.
JavaScript code generally follows JavaScript Style Guide and Coding Conventions with the most important being:
- 2 spaces indentation
- Variable names and functions use camelcase