Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Question on JDepend and metrics

Ranch Hand
Posts: 269
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
it's a teeny, tiny, wafer thin ad:
We need your help - Coderanch server fundraiser
    Bookmark Topic Watch Topic
  • New Topic