Contents > C: List of Design Rules > C.7 Package Rules

C.7 Package Rules

Rule: UnnamedCategory: Completeness
Severity: 1-highApplies to: all areas
Package has no name.

Rule: CapitalizationCategory: Naming
Severity: 3-lowApplies to: all areas
Package name has upper case letters. A common naming convention is that package names use all lower case letters.


Rule: KeywordCategory: Naming
Severity: 2-medApplies to: design
Package name is a Java or C++ keyword.


Rule: EmptyPackageCategory: Completeness
Severity: 2-medApplies to: all areas
The package has no contents.

Add model elements to the package, or delete it from the design.


Rule: DupClsNameCategory: Naming
Severity: 1-highApplies to: all areas
The package has two or more classes or interfaces with identical names.

This will cause problems during code generation. Rename the classes or interfaces so that the names are unique.

  • Value returned: name of the duplicate class/interface.


Rule: DepCycleCategory: Style
Severity: 1-highApplies to: all areas
The package has circular dependencies to other packages.

Cycles in the package dependency graph should be avoided. The packages participating in the cycle cannot be tested, reused, or released independently. The more packages participate in the cycle, the worse the problem is. Other design guidelines such as the Stable-Dependencies Principle (see rule SDP1) are also invariably violated.

Revise the design to eliminate the cycle.

  • See also: Dependency Inversion Principle [Mar03].
  • See DepPack for what constitutes dependencies between packages.
  • You can view the package dependency graph and its cycles in the Graph Structures View.
  • Value returned: number of packages in the cycle.


Rule: SDP1Category: Style
Severity: 2-medApplies to: all areas
Package violates the Stable-Dependencies Principle (SDP).

The package depends on another package, P that is less stable than itself (as measured by metric I). Package P is less stable and therefore more liable to change than this package. A change to P may ripple to this package. This is undesirable because this package is more stable and therefore harder to change.

Therefore, the Stable-Dependencies Principle says that dependencies should run in the direction of stabilities.

  • Suggested in [Mar03].
  • See DepPack for what constitutes dependencies between packages.
  • Value returned: name of the depended package that is less stable.


Rule: SDP2Category: Style
Severity: 2-medApplies to: all areas
Package violates the Stable-Dependencies Principle (SDP).

The package depends on another package that is less abstract than itself.

The Stable-Abstractions-Principle (SAP) says that a package should be as abstract (as measured by metric A) as it is stable (as measured by metric I). The Stable-Dependencies Principle (SDP) says that dependencies should run in the direction of stabilities.

Therefore, dependencies should run in the direction of abstraction: a package should be more abstract than the packages it depends on.

  • Suggested in [Mar03].
  • See DepPack for what constitutes dependencies between packages.
  • Value returned: name of the depended package that is less abstract.