Number of Public Callables in a Package (Size of API)

Count the number of public callables (methods or constructors) that are defined in any compilation unit that declares itself to be part of a package. This metric thus gives an indication of the size of the API provided by a package.

All methods and constructors are included in the count, including those defined in nested, local and anonymous classes. Also included are synthetic methods such as clinit.

Pre-packaged Query

Query name = "Semmle/Metrics/Packages/Size/Packages that define a large API"

Reports packages that define more than 150 public callables, in decreasing order, as a bar chart.

from MetricPackage p, int cs
where p.fromSource() and cs = p.getNumberOfPublicCallables() and cs > 150
select p,cs order by cs desc

.QL Source of Metric

This metric is defined in MetricPackage. Its definition is

    int getNumberOfPublicCallables() {
       result = sum(MetricRefType t | t.getPackage()=this | t.getNumberOfPublicCallables())
    }

References

Mark Lorenz and Jeff Kidd. Object-Oriented Software Metrics , Prentice Hall 1994.

Digg!Reddit!Del.icio.us!Facebook!Slashdot!Technorati!StumbleUpon!Ma.gnolia!

Comments
Only registered users can write comments!
 
< Prev   Next >