Welcome History Design Tools Tools About Us

Coding Conventions

by Kevin Garwood

General Coding Conventions

Class Level Coding Conventions

Package Naming Conventions

Convention Meaning
*.businessConceptLayer Contains classes that describe domain concepts that are meaningful to environmental health scientists
*.dataStorageLayer Contains:
  • classes that implement RIF services (Source files with a name *API)
  • classes that assemble and execute SQL queries
  • classes that manage database resources (eg: connection pooling)
*.fileFormats Contains classes that read and write business class objects to various file formats. In the RIF, these file formats include XML and HTML. Note that classes that serialise objects in JSON are not managed here but in the rifServices.restfulWebServices package.
*.system Contains classes which relate to RIF concepts but are used by classes throughout a project or across projects.
*.util Classes which have minimal dependencies on RIF-specific concepts. These classes become candidates for being used in other unrelated software projects.
*.restfulWebServices Classes that relate to supporting web services or for serialising business objects in the JSON format

Source File Naming Conventions

General Naming Conventions

Convention Meaning
Source files with name Abstract* An abstract class
Source files with name *API An interface describing the behaviour of a RIF service.

Naming Conventions in the Presentation Layer

General Naming Conventions

Convention Meaning
Source files ending in *Tool The main class for launching the GUI application. Contains a main(...) method.
Source files ending in *Dialog Class that manages a javax.swing.JDialog
Source files ending in *Panel Class that manages a javax.swing.JPanel
Source files ending in *Table Class that manages a javax.swing.JTable
include the type of GUI element in GUI variable names Follow these examples:

JButton myButton;

JTextArea descriptionTextArea;

JPanel mainPanel;

JComboBox sexComboBox;

Naming Conventions in the Business Concept Layer

Convention Meaning
Source files named *Option or *Type An enumerated type.

Naming Conventions in the Data Storage Layer

Convention Meaning
Source files named *Service A class that implements a RIF service interface (a source file named *API)
Source files named SQL* A class that contains code used to create SQL queries
Source files named *QueryFormatter A class that A class used to create the text for a particular type of SQL query. These classes help standardise the way the queries are constructed, make them more readable, and make it easier to alter the case of some phrases so they can operate with multiple database vendors.