|
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.
Wide Class Hierarchies
This query shows the inheritance graph of classes that have more than four direct subclasses. Library classes and
generated types are excluded from the statistics;
anonymous classes do not count towards the total number of direct subclasses.
How to Interpret the Query Results
Running the query on the source code of the JBoss application server yields the following
result, shown as a graph.
The screen shot is an extract of the class hierarchy of a class called ServiceMBeanSupport, which has no less than
117 direct subclasses.
How to Address the Query Results
Very wide class hierarchies can be an indication of sloppy object-oriented design. To increase encapsulation
and ease extensibility, it might be better to introduce additional abstractions into the hierarchy.
Source Code
References
|