Menu

Codestyle & Naming conventions

Mirco Gatz

Code style

Following there are some recommandations for naming packages, files and java code content.
We insist on their usage through out the whole project.

Naming conventions

  • use speaking names
  • use common abbreviations
  • do not insist on short names espacially for variable and class names
  • use java default camel case

Use the following conventions for java interace and class names:

  • name interfaces like what they are meant to do (e.g. UserManager)
  • name implementation according to the interface adding the implementation type (e.g. DefaultUserManager or LDAPUserManager)
  • name abstract class like such (e.g. AbstractUserManager)

Namespaces

Always use the module in the packages you create. Follow the given example.

Module name: "core"
Base package: "org.e1.core"
Util classes: "org.e1.core.utils"
a feature: "org.e1.core.[feature name]"

Do not use dedicated packages for interfaces and their implementation.

Some package names are fixed and module unspecific:

  • Configuration package for spring: "org.e1.config"
  • POJO package for hibernate: "org.e1.persistence"

You should use these through all modules to ensure proper working of spring and hibernate. Do not create any subpackages of these.


Related

Wiki: Home

MongoDB Logo MongoDB