Efferent Coupling of a Method (Outgoing Dependencies; Fan-out)

The number of callables (constructors or methods) that may be directly called by this callable, either by immediate reference or through overriding.

A high efferent coupling indicates a method that makes many different calls, and perhaps it should be re-structured.

Pre-packaged Query

Query name = "Semmle/Metrics/Packages/High efferent coupling (fanout) methods"

Reports methods with an efferent coupling of greater than 60, in descending order, displayed as a bar chart.

from MetricCallable c, int n
where c.fromSource() 
      and 
      n=c.getEfferentCoupling()
      and
      n > 60
select c, n order by n desc

.QL Source of Metric

This metric is defined in the class MetricCallable. It consists both of the definition of dependency (here polymorphic calls) and the definition of the metric itself:

   MetricCallable getADependency() {
      this.polyCalls(result)
   }

   int getEfferentCoupling() {
      result = count(MetricCallable m | this.getADependency() = m)
   }

References

Jakarta Project, Apache Software Foundation. Metrics - FanOut 2002.

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

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