Acyclic Dependencies Principle (ADP) is important from a deployment perspective. Along with packages being reusable and maintanable, the should also be deployable as well. Just as in the class design, the package design should have defined dependencies so that it is deployment-friendly.
ADP states:
The dependency structure between packages must be a Directed Acyclic Graph (DAG).
DAG implies that in the package dependency traversal, there should be no path which includes the same package more than once. Why? The simplest cyclic dependency means that a package A depends on package B, which again depends on package A. Not only does it lead to wrong class dependencies, but also makes deployment a nightmare. DAG leads to a clear dependency structure, which can instantly identify the packages that can get affected if a certain package is modified.
Cyclic dependencies usually happen because multiple developers might work on the same package, on the same module or on the same class. These cyclick dependencies can be broken. One of the methods is to use Dependency Inversion Principle (DIP). Robert Martin has excellent illustration (pdf) of breaking the cyclic dependencies.
The dependency graphs lead directly to the map for building the packages and the entire application. Considering this at the early stages of package design saves lot of time and trouble.
Back to Design Principles.
Technorati tags: acyclic dependencies principle, adp, design principle, directed acyclic graph, dag, object oriented
Copyright Abhijit Nadgouda.


August 28th, 2006 at 12:00 am
[...] Acyclic Dependencies Principle (ADP) [...]