ifacethoughts

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.

Discussion [Participate or Link]

  1. iface thoughts » Blog Archive » OO Design Principles said:

    [...] Acyclic Dependencies Principle (ADP) [...]

Say your thought!

Who are you?

If you want to use HTML you can use these tags: <a>, <em>, <strong>, <abbr>, <code>, <blockquote>. Closing the tags will be appreciated as this site uses valid XHTML.

freshthoughts

contactme

Abhijit Nadgouda
iface Consulting
India
+91 9819820312
Y!: anadgouda
GTalk: anadgouda@gmail.com
MSN: anadgouda@hotmail.com
Skype: anadgouda
My bookmarks

currentproject

Complete Wellbeing

badgesand...

This is the weblog of Abhijit Nadgouda where he writes down his thoughts on software development and related topics. You are invited to subscribe to the feed to stay updated or check out more subscription options. Or you can choose to browse by one of the topics.

Twitter - #mumbai - The city has started working today. The fears are still there, but the spirit will help in fighting it.