|
This metric simply measures the number of immediate subtypes of a reference type in
the inheritance hierarchy.
This number is an indicator of the number of responsibilities of a class,
and of its importance in the design of the system as a whole. Rosenberg and
Hyatt recommend that classes with a large number of children be thoroughly
tested.
Pre-packaged Query
Name of Query = "Semmle/Metrics/Types/Reftypes with many children"
Reports reference types in the source that have more than more than five
immediate descendants, in decreasing order, as a bar chart.
from MetricRefType t, int n
where t.fromSource() and
n = t.getNumberOfChildren() and
n > 5
select t,n order by n desc
.QL Source of Metric
This metric is defined in the class MetricRefType. Its definition
reads:
int getNumberOfChildren() {
result = count(this.getASubtype())
}
References
Shyam R. Chidamber and
Chris F. Kemerer.
A Metrics Suite for Object Oriented Design
.
IEEE Transactions on Software Engineering,
20(6), pages 476-493, June 1994.
Linda H. Rosenberg and Lawrence E. Hyatt.
Software Quality Metrics for Object-Oriented Environments
NASA Software Assurance Technology Center, April 1997.
|