Average Fan-in of a Package

The average fan-in of a package is the average afferent coupling taken over all callables that occur in the package.

This metric measures how often each callable (method or constructor) is called by others, averaged over the whole package. This is an alternative to the more common notion of afferent coupling of a package.

Pre-packaged Query

Name of query = "Semmle/Metrics/Packages/Averages/Average method/constructor fan-in"

Calculates the average fan-in for each package and displays it as a bar chart.

from MetricPackage p, float f
where f = p.getAverageFanIn() and p.fromSource()
select p, f order by f desc

.QL Source of Metric

This metric is defined in MetricPackage:

    float getAverageFanIn() {
      result = avg(RefType t, MetricCallable c |
                   c=t.getACallable() and t.getPackage()=this |
                   c.getAfferentCoupling())
    }

References

Marius Marin, Arie van Deursen, Leon Moonen. Identifying aspects using fan-in analysis Proceedings of the 11th Working Conference on Reverse Engineering, pages 131-142, 2004.

Digg!Reddit!Del.icio.us!Facebook!Slashdot!Technorati!StumbleUpon!Ma.gnolia!

Comments
Only registered users can write comments!
 
< Prev   Next >