12.07.2015 Views

DEV475 Mastering Object-Oriented Analysis and Design with UML ...

DEV475 Mastering Object-Oriented Analysis and Design with UML ...

DEV475 Mastering Object-Oriented Analysis and Design with UML ...

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Module 5 - Architectural <strong>Analysis</strong>Avoiding Circular DependenciesAvoiding Circular DependenciesAAABHierarchyshould beacyclicBBCCCircular dependencies make it impossibleto reuse one package <strong>with</strong>out the other.<strong>Mastering</strong> <strong>Object</strong> <strong>Oriented</strong> <strong>Analysis</strong> <strong>and</strong> <strong>Design</strong> <strong>with</strong> <strong>UML</strong>Copyright © 2003 Rational Software, all rights reserved 9A'It is desirable that the package hierarchy be acyclic. This means that the followingsituation should be avoided (if possible):• Package A uses package B, which uses package A.If a circular dependency exists between Package A <strong>and</strong> Package B, if you changePackage A it might cause a change in Package B, which might cause a change inPackage A, etc. A circular dependency between packages A <strong>and</strong> B means that theywill effectively have to be treated as a single package.Circles wider than two packages must also be avoided. For example, package A usespackage B, which uses package C, which uses package A.Circular dependencies may be able to be broken by splitting one of the packages intotwo smaller ones. In the above example, the elements in package A that wereneeded by the other packages were factored out into their own package, A’, <strong>and</strong> theappropriate dependencies were added.5 - 9

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!