|
This estimates the number of different callables (= methods or constructors) that can be executed when
a callable is invoked on this type.
In ideal world, we would compute a
precise static approximation of the dynamic call graph, and then take
the number of reachable callables from each callable. However, there
are two problems with such an approach. First, it is very expensive
to compute such an approximation. Second, the approximation is likely
to be crude, even when using these expensive algorithms.
For that reason, Chidamber and Kemerer suggested in their seminal 1994
article that one just counts the number of calls within
the classes callables. Indeed Spinellis's ckjm tool does precisely that,
and we follow its lead.
Pre-packaged Query
Name of query = "Semmle/Metrics/Types/RefTypes that have high response"
Reports types that have a response higher than 100.
from MetricRefType t, int d
where t.fromSource() and d = t.getResponse() and d > 100
select t, d order by d desc
.QL Source of Metric
This metric is defined in MetricRefType. It reads:
int getResponse() {
result = sum(Callable c | c.getDeclaringType()=this | count(c.getACall()))
}
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.
David Grove,
Greg DeFouw,
Jeffrey Dean,
Craig Chambers.
Call Graph Construction in Object-Oriented Languages
.
In: Proceedings of OOPSLA '97, pages 108-124, 1997.
Diomides D. Spinnelis.
Code Quality: The Open Source Perspective.
Addison-Wesley 2007.
Diomides D. Spinnelis.
ckjm - Chidamber and Kemerer Java Metrics.
(implementation of CK metrics), 2006.
|