CSC/ECE 517 Fall 2009/wiki3 18 301
Topic: Stable Dependencies Principle
The instability of any package can be calculated using the following formula:
I (instability) = Ce / ( Ca + Ce )
In this formula:
Ce – the number of other modules that our package requires to operate. In other words, this is an indicator of package independence.
Ca – the number of packages that can be viewed as “dependents“, i.e., “depend upon classes within the package”. This is an indicator of package responsibility.
Therefore, in order for a package to be completely independent and also stable, it should not be dependent upon other packages.
Using the formula: I = 0 / ( Ca + 0 ) = 0, has the instability of zero.
Respectively, instable or irresponsible packages would have instability of 1 as shown below:
I = Ce / ( 0 + Ce ) = Ce / Ce = 1