Acyclic Dependencies Principle

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: , , , , ,

Copyright Abhijit Nadgouda.

Posted in design. 1 Comment »

One Response to “Acyclic Dependencies Principle”

  1. Ralf's Sudelbücher : .NET naked - See these hitherto unpublished pictures of the .NET Framework architecture Says:

    […] 3 edition (July 30, 2003), ISBN 0072471468 Share this post: Email it! | bookmark it! | digg it! | reddit! Published Sunday, August 27, 2006 11:05 AM by ralfw Filed under: English Postings, ApplicationArchitecture, General Software Development […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: