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 21 Next »

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

Also see Naming conventions.

Code style

Magnolia contributors are kindly requested to follow these simple conventions below:

  • Standard Java coding conventions (download the PDF, because the HTML version is very badly formatted in some places)
  • 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)
  • Read http://dev.magnolia-cms.com/~gjoseph/on-code-readability

Also ensure that you have the right license headers in place !

See the file attached for Eclipse Preferences (which you can simply import and everything should be done).

Preferences>Java>Code Style>Code Templates>Automatically add comments... is not used as there are different headers for the different editions. The alternative is ... (todo)

serialVersionUID's

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).

Javadoc

  • Class-level documentation is mandatory.
    • we do use @version $Id$
    • we don't use @author tags any longer as we're usually not interested in the one who had create the file (SCM could tell you if required)
  • First sentence of any Javadoc comment must finish with punctuation. (This is/was needed for summary pages/tables to include the first sentence next to the described element)
  • DRY.
  • See http://dev.magnolia-cms.com/~gjoseph/on-code-readability
  • No labels