|
SemmleCode Professional comes with a wide range of pre-packaged analyses, from architectural properties and metrics, to statement-level checks for likely bugs and violations of best practice.
Inheritance Depth Distribution
This query shows the distribution of inheritance depth across all types, i.e. classes and interfaces. Library types are ignored.
How to Interpret the Query Results
The result of this query is a line graph showing, for each number n, how many types have an inheritance depth of n, where
the inheritance depth of a type is the length of a longest path in the inheritance hierarchy from java.lang.Object to the type.
Running the query on the source code of the JBoss application server yields the following graph:
When hovering the mouse pointer over a specific depth value, the number of types having this inheritance depth is displayed:
In the example, we can see that there are 342 types with an inheritance depth of 5.
How to Address the Query Results
The depth of a type is an indication of how deeply nested a type is in a given design.
Very deep types can be an indication of over-engineering, whereas a system with predominantly shallow types
may not be exploiting object-orientation to the full.
Source Code
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.
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.
|