NPM (Number of Public Methods) counts the public methods exposed by classes and interfaces in a file. NPM is the size of the unit’s API surface.Documentation Index
Fetch the complete documentation index at: https://mehen.ophi.dev/llms.txt
Use this file to discover all available pages before exploring further.
What mehen emits
| Key | Type | Description |
|---|---|---|
npm | int | Total public methods across classes and interfaces. |
npm.classes | int | NPM contributed by classes. |
npm.interfaces | int | NPM contributed by interfaces. |
npm.class_methods | int | Alias of npm.classes. |
npm.interface_methods | int | Alias of npm.interfaces. |
npm.classes_average | float | Mean public methods per class. |
npm.interfaces_average | float | Mean public methods per interface. |
npm.total_methods | int | Alias of npm. |
npm.average | float | Mean public methods per declaration. |
Despite the name, this metric has nothing to do with the npm package manager. NPM here stands for
Number of Public Methods, a classic CK-style object-oriented metric.
What counts as “public”
| Language | Public method is… |
|---|---|
| Java / Kotlin | A method declared public (or with no modifier in Kotlin). |
| TypeScript / JS | A class method without private / protected / # prefix. |
| Python | A method that does not start with _. |
| Ruby | A method not declared private or protected. |
How to read it
Conventional reading:npm | Interpretation |
|---|---|
| 1–10 | Small, focused class. |
| 11–25 | Normal application class. |
| 26+ | God-class candidate. |
References
- Lorenz, M. & Kidd, J. (1994). Object-Oriented Software Metrics: A Practical Guide. Prentice Hall.
- Chidamber & Kemerer (1994). A Metrics Suite for Object Oriented Design. IEEE TSE.