Acyclic dependencies principle

From CSSEMediaWiki
Revision as of 04:55, 29 July 2008 by David Thomson (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

"The dependency structure between packages must be a Directed Acyclic Graph (DAG)." http://ifacethoughts.net

The Acyclic dependencies principle states that when traversing the package dependency graph, there should be no path from a package back to that package. If there is a path back to the original package, there is a cycle in the graph (ie it is not Acyclic). This occurs when package A depends on package B, and package B depends on package A. This is a transitive relationship, so if package C depends on package B, then package C must not depend on package A or B.

This is important from a deployment point of view, as well as from a maintenance perspective. If the dependency structure is a DAG, then building the application is trivially a traversal of the dependency graph. A cyclic dependency graph can result in problems when building the system. (If package A needs package B, but package B needs package A, which should you build first?).

Also, a system with no package cyclic dependencies will be easier to maintain. It will be obvious which packages may be affected by making changes to a specific package; simply traverse the dependency graph from the package that was changed.

Personal tools