|
The efferent coupling of a package
p is the number of types inside
p that directly depends on types outside p.
A high efferent coupling may be an indication that perhaps this
package could be merged with others. However, the main function
of efferent coupling is to define the stability metric.
For a detailed discussion of the notion of dependency between
types, please refer to
Afferent Coupling of a Type.
Pre-packaged Query
Query name = "Semmle/Metrics/Packages/Coupling/Packages that have high efferent coupling"
Reports packages that have efferent coupling greater than 20, in descending order, as a bar chart.
from MetricPackage p, int c
where p.fromSource() and c = p.getEfferentCoupling() and c > 20
select p, c order by c desc
.QL Source of Metric
This metric is defined in MetricPackage. Its definition
reads:
int getEfferentCoupling() {
result = count(RefType t |
t.getPackage() = this
and
exists(RefType s |
s.getPackage() != this
and
depends(t,s)))
}
References
Robert C. Martin. OO Design Quality Metrics. October 24, 1994.
Robert C. Martin.
Agile Software Development, Principles, Patterns and Practices.
Addison Wesley, 2002.
Andrew Glover
.
In Pursuit of Code Quality: Code Quality for Software Architects.
April 2006.
Jack Shirazi and Kirk Pepperdine.
Eye on performance: Determining the riskiness of change.
July 2004.
|