Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Your Rating: Results: 1 Star2 Star3 Star4 Star5 Star 1 rates

General Style

Order of methods

We aim for best readability - that's we (from now on) put methods is a specific order:

  • technical/config methods first (e.g. getters, setters, add-methods for collections, ...) - business methods last
  • methods that logically belong together should be grouped (e.g. if there's 2 constructors they should be placed next to each other)


  • .* Imports are only allowed for static ones (checked by our checkstyle setting)
    • you might want to configure your Eclipse to use 2 as Number of static imports needed for .* (Preferences -> Java -> Codestyle -> Organize Imports)


  • Tab policy: spaces only (warning)
  • Indentation: 4 spaces
  • Maximum line width: 120 (no strong rule here - don't put exceptions declarations on new lines just to respect this, for instance)


  • We preferably don't use abbreviations in classnames (only exception to that rule is MgnlSomething)


  • Single-line if-statements: we always use curly braces
  • Unnecessary else-branch: if the else is not necessary (e.g. because if-branch always returns or throws an exception) we omit it


  • for optimal refactoring support we use the @Override for all methods that override methods declared in superclasses/implemented interface
    • Hint: you might want to adapt compiler settings of your IDE to show Errors on missing @Override's (Eclipse and Idea provide that option)


We don't explicitly set serialVersionUID's as we don't want to decide ourselves when these id's should be updated. We rely on the JVM doing that for us (being aware that this id's could potentially differ from JVM to JVM). IF for any (valid) reason, such an id would be needed for a given class, the reason needs to be documented in the code. Failing that, there's a good chance the field will be removed by a fellow zealous developer.


  • if you come across a //$NON-NLS-1$ please just delete it - that's legacy stuff created by Eclipse - we don't want to keep that!


  • these are used for minor issues or hints. As it might be handy to ask the author for details and we don't want to spend too much time on querying the SCM, it's now mandatory to add the author's name:
    • e.g. TODO dlipp - tell the world we'll now always add authors to the TODOs and FIXMEs
  • No labels