Java Package Naming

For package naming in java there is already a standard defined by Sun/Oracle to prevent conflicting package names between companies. This is the first guide that must be followed: http://download.oracle.com/javase/tutorial/java/package/namingpkgs.html (Naming a Package)

Apart from that there is need for a convention to prevent name clashes inside of GSI/FAIR and we suggest to name the packages containing division, department, group, project and module (a part of a project). Like this its possible for projects to span several departments (e.g. FESA) and not to have name clashes in the package naming. So this is our suggestions with some examples:

de.gsi.<division>.<department>.<group>.<project>.<module>
an alternative if the project is done by several groups in a department can be
de.gsi.<division>.<department>.<project>.<module>

Lets imagine a project "commons" that contains code containing some convenience classes and tools. Now lets imagine that several groups and departments have done such a project. The following example shows how the suggested package naming prevents problems:
  • de.gsi.aco.app.commons – Common tools of Control System department, APP group
  • de.gsi.aco.fec.commons – Common tools of Control System department, FEC group
  • de.gsi.aco.commons – Common tools of Cotrol System department
  • de.gsi.bea.commons – Common tools of Beam Instrumentation department

This topic: Applications > WebHome > AppGuidelinesMain > AppHowToJavaPackageNaming
Topic revision: 13 Apr 2020, JuttaFitzek
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback