Have you implemented OpenMRS? Please participate in the Implementation Site Survey. If you already have, thank you!
Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Attribution

  • Attribution is to be done within commit comments.
  • When a committer is applying a patch, the author(s) of the patch should be attributed within the commit comment according to the the comment conventions.
  • Attribution (either author or contributing authors) should notbe placed into source code. When encountered, such attribution should be removed by (or with permission from) the original author(s). Contributions that require attribution (i.e., author(s) demanding attribution within the code contributions) will be graciously refused or removed from the repository.

    Panel

    (NOTE: this attribution-free coding policy took effect after version 1.1, so you may see some attribution in the existing code; we are gradually removing attribution from our code base)

...

  • We use the automatic formatting feature of Eclipseto generate consistently formatted code
    • Simply use

      Code Block
      control-shift-f

      to format a file

    • OpenMRS formatting file for Eclipse: OpenMRSFormatter.xml
      • Install at Window -> Preferences -> Java -> Code Style -> Formatter
    • OpenMRS code template file for Eclipse: OpenMRSCodeTemplate.xml
      • Install at Window -> Preferences -> Java -> Code Style -> Code Templates
  • Use

    Code Block
    control-shift-o

    for finding/formatting/organizing imports - Very useful!

Exception Handling Conventions

...

  • We deprecate public methods instead of changing/deleting them in order to preserve backwards compatibility. We will delete all deprecated methods when we make a new version (eg from 1.x to 2.0)
  • Use both the @deprecated @Deprecated annotation and the @Deprecated @deprecated javadoc comment
  • The @Deprecated @deprecated javadoc annotation should point to the new method that is replacing the current one
  • DAO methods do not have to go through a deprecation cycle. They can be changed/deleted outright

...