Software Development Guidelines

From GreenVulcano Wiki
Revision as of 10:58, 3 January 2016 by D.barra (talk | contribs) (Avoid references to your own workspace files)
Jump to: navigation, search

Rationale

The GreenVulcano code base has been growing over time. While the code has traditionally been "reviewed" by one or two people (our historical "good dictators") before submission to public availability, this is becoming less and less the case due to our increasing core development community. Therefore, some self-discipline is needed in order to improve collaboration - and, sometimes, reduce the frustration due to switching from one style to the other between different source files (and often even within the same file).

This is an open, ongoing, collaborative document! If you feel like a new guideline is needed for the project, then:

  • Discuss it with senior colleagues to check that it actually makes sense, then
  • Add it to this document, in the relevant section.

Design

This section covers common guidelines concerning the design of our software.

Clearly separate concerns in your design

A.K.A. 
No business and presentation logic mix-up
Importance 
HIGH
Reason 
Whenever possible, our software has to make no assumptions on the context where it runs. As a matter of example: it happened that software originally targeting the desktop needed to be ported to the cloud - it was a bloodshed to separate the actual processing logic from "buttons", "text fields" and "properties".

Never hardcode settings or "magic" values

A.K.A. 
you die if you do that
Importance 
HIGH
Reason 
Your code can (and will) be used in contexts which are totally unknown to you. It will need either to be totally context-independent, or to make all context-related aspects configurable.
Example
A ConfigProperties reader must have a constructor specifying "which" file to read.

Provide a reasonable default for configuration-based software

A.K.A 
Convention Over Configuration
Importance
HIGH
Reason 
We mainly develop middleware. This usually requires a lot of knowledge about the environment the software runs within, which means a lot of configuration. The user may easily feel overwhelmed by having to configure each and every bit. Therefore, when a "default" behavior just makes sense, in absence of a more specific configuration
Example
Besides having a constructor specifying which file to read, a ConfigProperties reader shall also have a constructor omitting such parameter, which shall search for "config.properties" in the classpath or current working directory.

Avoid references to your own workspace files

A.K.A. 
no /home/johndoe/projects on SVN or GIT
Importance 
MEDIUM
Reason 
Every developer has his/her own settings and favourite IDE layouts. If such preferences are placed in a shared, versioned file, a commit war will inevitably start - causing frustration in the entire team/community. In order to avoid this, only place common settings in the versioned files, and provide a template for unversioned user properties.

Naming

Formatting

Versioning