OpenLMIS Coding Standards

For OpenLMIS v3+

Service Style Guide:


Spring Data Rest and Spring MVC

  1. Spring Data Rest (SDR) is suitable for prototyping and sometimes for Reference Data.  Spring MVC (typically backed by Spring Data) is to be used once an interface needs to be published.
  2. Before designing an interface in MVC, a first draft should be written in RAML and reviewed before the implementation proceeds*.  The RAML should outline the new Resources, Actions and Representations being proposed with descriptions that cover the “why” for major components.
  3. If an interface exists in SDR, MVC endpoints shouldn’t also be added.  The decision to go from SDR to MVC, or weather to start with SDR at all is a judicious one.  One resource should never be described with both SDR and MVC at the same time.  Components will not move from MVC to SDR.
  4. Interfaces may expose links to other resources, pages, etc.  We however are not aiming to fully support HATEOAS nor HAL.

* development may proceed, however until the draft published interface is reviewed, it should be expected to change.


For OpenLMIS v1-v2:

Please see CONTRIBUTING.MD and STYLE-GUIDE.MD in the source code.

Per the 2015 Community Meeting, the Technical Committee will establish and enforce standards for code quality.  Some of the high level decisions:

  • As much as possible, code standards are tracked automatically by Sonar
  • With regards to legacy code:  once standards are established, the "don't make things worse" principle will apply.  New code must adhere to standards.  If legacy code files are touched, newly added code should adhere to standards.  Legacy code is opportunistically updated - if a contributor is working in an older file, it is the contributor's discretion whether to bring the source file up to standards.


OpenLMIS: the global initiative for powerful LMIS software