CODERU rules

Overview

The base idea behind the coderu is to organize the packages according to logical modules hierarchy. According to this structure the packages are allowed to access only other ones placed in its subpackages. This base structure is given by the basic rule.

Hierarchy structure is best suitable to decompose the complex task into small ones, but less likely to provide service to other components. In order to correct that the common rule is in place and allows the access to a package from outside of its direct package hierarchy. The higher is a "common" package placed in the package hierarchy the more classes can access it and the fewer access rights have the classes in this package.

Although it is possible to shape any acyclic classes graph according to the both rules above, api and factory rules exist in order to facilitate component oriented design.

The impl rule facilitates component oriented design too and can be used for information hiding on any place.

There are no restriction how coderu packages can be combined. You can for example have an IMPL below an API or vice versa.

Recurcive Access

  • If package P(a) has access to package P(b), P(a) has access to all direct children of P(b), except IMPL. This rule is recurcive.

Basic Rule

For all packages without special semantic:

  • A package P has access only to its direct children and they succeeders according Recurcive Access rule.
  • Access to siblings packages is not allowed.
  • Access to parent package is not allowed.

basic rule

Common Rule

  • All sibling packages of COMMON package and they descendants have access to COMMON.

basic rule

Factory Rule

  • A FACTORY package and all of its descendants have access to all siblings of FACTORY.

basic rule

API Rule

Any package has access to any API with the following restrictions:

  • The succesors of the API has no access to it.
    For example p[10] → API[1].
  • An API package has no access to his nephew API packages.
    For example API[1] → API[2].
  • An COMMON package has no access to his nephew API packages.
    For example COMMON[1]API[2] .
  • The siblings of the FACTORY have no access to it's (factory's) API.

Additional restrictions:

  • API package must not access its sibling COMMON package.
    For example API[1]COMMON[1].

basic rule

Impl Rule

  • Makes packages inaccessible from outside.
  • Only parent package or sibling FACTORY package have access to IMPL.

basic rule