|
This measure intends to capture the tradeoff between
abstractness
and
instability.
The ideal situation occurs when the sum of abstractness and instability is one. That is, a package is completely abstract and stable (abstractness=1 and instability=0) or it is concrete and unstable (abstractness=0 and instability=1). We thus measure the distance from that ideal situation.
It is recommended that cases where the distance is greater than 0.7 are scrutinized closely.
Pre-packaged Query
Query name = "Semmle/Metrics/Packages/Coupling/Packages far from main line"
Reports packages that are further than 0.7 from the main line
(abstractness + instability = 1),
in decreasing order, as a bar chart.
from MetricPackage p, float c
where p.fromSource() and c = p.getDistanceFromMain() and c > 0.7
select p, c order by c desc
.QL Source of Metric
This metric is defined in MetricPackage, and its definition
is a direct translation of the formula:
float getDistanceFromMain() {
exists(float r |
r=this.abstractness() + this.getInstability() - 1
and
( (r >= 0 and result = r)
or
(r < 0 and result = -r) ) )
}
References
Robert C. Martin. Object-Oriented Design Metrics Ensure Robust Software. January 6, 2003.
Robert C. Martin. OO Design Quality Metrics. October 24, 1994.
Robert C. Martin.
Agile Software Development, Principles, Patterns and Practices.
Addison Wesley, 2002.
Bill Venners.
How Useful are Code Metrics?
Artima Developer, April 26, 2006.
Wikipedia.
Software Package Metrics
.
2007.
|