Introduction
This document contains information related to source code standards. These standards and guidelines will be used as a reference for source code artifacts created in the EA construction project.
Java Coding Standards
We encourage to use Sun's coding standard because of there wide community acceptance.
Naming Variables
Variable name should be fully spelled out. Use of
<CTRL>+<SPACE> hot key combination in
Eclipse can be very helpful. The variables declared in different scope should be preceeded with a meeningful prefix (see below).
Variable prefixes
| Variable type | Prefix | Example |
|---|
| Field | f | fExampleVariable |
| Static Field | s | sExampleVariable |
| Parameters | p | pExampleVariable |
| Local Variables | l | lExampleVariable |
Eclipse can support variable prefixing for different scope. Go to
<window>/<preferences>/<java>/<code styles> menu in
Eclipse and use put
f for
Fields,
s for
Static etc…
Formatting code
Organising imports
We rely on
Eclipse support for organising imports.
<CTRL>+O does the job.
Naming Interface/Implementaition pairs
The interface name should be spelled out, the implementing class name should be suffixed with
Impl at the end. For example:
- interface BusinesTierController
- class BusinesTierControllerImpl implements BusinesTierController
Naming Architectural components.
This rule should make it easier to know what some of the implementation details and/or architectural responsibilities of the software components are by just looking at their names.
Types or architectural components:
- Data access object
- Domain Object mapped to database through Hibernate
- Spring managed bean with declarative transactions enabled