Stable dependencies principle

From CSSEMediaWiki
Revision as of 07:36, 5 October 2008 by Tureiti Keith (Talk | contribs)
Jump to: navigation, search

In general something is stable if it has steadfastness, reliability, dependability and constancy, as of character or purpose. Therefore a package can be considered stable if it is not changed frequently, or if there is no need to change it frequently. Thus other packages can reliably depend on this stable package. So we could say dependencies between packages in a design should always be in the direction of the stability of the packages. A package should only depend upon packages that are more stable than itself. This can be expanded on classes as well. Classes should only depend on more stable classes.

It is important to identify stable packages and packages that change. The packages that are expected to changes should be designed to change. Most of the times, but not always, abstract classes and interfaces are not dependent on others and tend to be more stable as in contrast to concrete or implementation classes. This is because the abstract classes or interfaces typically represent a higher abstraction of a design and not the implementation.

Quantifying Stability

In [1], a measure of instability (I) is given as "dividing efferent coupling [Ce] by the sum of both efferent and afferent [Ca] coupling". I = (Ce / (Ca + Ce)). Here, I belongs to the set of real numbers between 0 and 1 inclusive, where 0 is completely stable.

References

  1. ^ http://www.ibm.com/developerworks/java/library/j-cq04256/

See also

Personal tools