Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updating the link to the best Practices Guide (resides in OFBIZ recently)

...

The OFBiz project follows the Sun coding standards for Java source code. For information regarding this standard please visit http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html

The line length of 150 is an exception to the Sun standard

Here is an example of a Java formatter for Eclipse

For Groovy we suggest you read http://www.groovy-lang.org/style-guide.html but we don't expect people to follow all details there, still a good read..

...

  • Java
    The OFBiz project follows the Maven Standard Directory Layout to organise its Java files. At the moment of writing there are only a few unit tests (but a lot of what we so far call integration tests) so you will mostly find the ../src/main/java/org/apache/ofbiz.. path in components. As of today in few components in framework (base, entity, start, webapp) you will also find the ..src/test/java/org/apache/ofbiz.. path
  • Groovy
    We decided to use a groovyScripts sub-folder under components folders to put parsed Groovy scripts. We named it groovyScripts rather than script because other script languages could be used in the future
    Even if it's no used yet we reserved the groovy sub-folder under components folders for pre-compiled Groovy scripts. A distant goal is to replace Minilang by a Groovy DSL...
  • Freemarker
    The Freemarker templates are in template sub-folders under components folders
  • Minilang
    The Minilang map processors and minilang scripts are in minilang sub-folders under components folders

Misc.

In OFBiz we don't set serialVersionUID but let the system handles that for us and rather use @SuppressWarnings("serial") where necessary.
More at https://markmail.org/message/jjhf5p5hbhon7vam and above.

Entity Definitions

Entity Names

...

Service Definitions

Best Practices

Apache OFBiz Best Practices Guide


License Headers

Each and every source file should contain the ASL2.0 header:

...

Code Block
languagexml
themeConfluence
    <view-map name="FindParty" type="screen" page="component://mycomponent/widget/PartyScreens.xml#FindParty"/>

...


widget screens

TODO: conventions for screen names (top-level screens, included screens, decorators)

...