JDepend uses a metric called instability where I = Efferent Coupling / (Afferant + Efferent Couplings). Afferent Coupling is the number of classes that depend upon classes in this component. Efferent Coupling is the number of classes in the component that depend upon classes outside this component. As far as I understand, the more afferent, the more stable, thus the better. But the metrics 'I' is discontinuous. If you have no efferent coupling (the component do not depend on any classes outside the component), then I=0 whatever the afferent coupling. Consider two components Comp1 et Comp2 without any efferent coupling . Comp1 has 10 afferent couplings and Comp2 only 1. Regarding 'I', Comp1 and Comp2 have the same qualities. But now if Comp1 and Comp2 have 1 efferent coupling, then I=0.5 for Comp2 and I=0,09 for Comp1. Moreover I is undefined if Ce and Ca are both equal to 0. In fact Comp1 is much more stable than Comp2. Would not it be better to choose a metric like: I = (Ce+1) / (Ca+Ce+1) W.
Hi Wilfred, The first thing to remember is that metrics are a guideline, not a God (Martin, whose work JDepend is based on, says this himself in the original paper that he started working on these ideas in). Second, being stable or instable is neither good nor bad. Its just that a software system should have parts that are easy to change (instable), and parts that are hard to change (stable). The idea of a package with I=0 is just that it should be the most stable part of the system, since things depend on it but it doesn't depend on anything else. An I=1 means that nothing depends on it, and its therefore free to change. My $0.02... John
Did you ever grow anything in the garden of your mind? - Fred Rogers. Tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth