Stable Dependencies Fixture
I've written yet another fixture to round out the JDepend suite of FitNesse fixtures. This fixture ensures that system being analyzed conforms to the Stable Dependencies Principle (SDP).
The SDP says that modules that are hard to change should not depend on modules that are easy to change. The reason is that such a dependency makes the easy to change module harder to change because of the impact on the depending module. For example, if EZ is a module that we have designed to be easy to change; and if H is a module that is hard to change because it has many other modules depending on it; then if the author of H hangs a dependency on EZ, then EZ will become hard to change because of the impact of a change on H.
This principles can be quanitfied by computing a metric named I for each module. This metric is Ce / (Ce + Ca), where Ce is the number of modules that our module depends upon, and Ca is the number of modules that depend on our module. The metric ranges from zero to one. A zero means that the module is stable because it is depended upon but does not depend on any other module. A one means that the module is instable because nobody depends upon it, but it depends on others.
The SDP, in quantitative form, says that when two modules depend upon each other, the I metric of the depender should be greater than or equal to the I metric of the dependee. Thus if module A depends on module B, then the I metric of module B should be lower than the I metric of module A.
The fixture that checks this is named StableDependencies. It is in the moduleDependencyFixture package which can be downloaded here.
You use it you must first invoke a Module Dependencies table that lists all the modules that you want checked. Then you simply create a single celled table as follows:
This fixture will iteration through all the modules listed in the Module Dependencies table, and will create a row for every dependency. The rows will name the dependency by showing both the source and target modules. It will then show the two I metrics, and will color the result either red or green appropriately.
A sample output of all the tables and fixtures in all three of the blogs on this topic can be viewed here
Add Child Page to StableDependenciesFixture