Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Classes and interfaces name conventions

Base package for all classes is org.openhubframework.openhub.

There are the following name conventions for classes and interfaces:

...RouteRoute implementation
...ConverterConverter implementation

...Service

Service implementation

...DAO

DAO interfaces

...Exception

Exception

...Controller

MVC controller

...Factory

Class that creates another classes

...Test

Test class

...Tools

Class with useful static methods

...Helper

Helper class, usually for local use

...Enum

Enumeration

Method name conventions

There are the following name conventions for methods:

set...

sets value or reference

 

get...

gets value or reference

Method always returns not-null value or object, never null. It throws exception instead of null.

add...

adds value/reference

 

update...

data/state change

 

delete...

data removal

 

create...

new object creation

 

exists...

existence check

It returns true or false.

check...

common check

It returns true or false.

validate...

validates input values or internal object state

 

findAll...

finds all possible values

Never returns null, only empty collection.

findBy... or findXyzBy...

finds value(s) by specified input parameters

If method returns only one value then it can be null.

test...

test method, usually annotated by @Test

 

 

Demarcation of transactions - there is expected readonly transaction for methods which have the following prefixes: get, exists, check, findAll, find.

Syntax rules

Adhere to basic Java Code Conventions from Sun/Oracle.

Common syntax rules:

  • Basic unit of indentation is 4 spaces. Tab should be converted to spaces.
  • Line lenght length is 120 characters.
  • Maximum size of one class shoudnshouldn't exceed 700 lines.
  • Use English language exclusively - for class, interface and method names, in comments, GUI, etc.
  • Use UTF-8 character set in all source code files.


...