Skip to main content
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.

What mehen emits

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”

How to read it

Conventional reading: Pair with WMC to gauge whether the surface is wide and heavy, and with NPA to gauge whether the class encapsulates state.

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.

See also

  • NPA — number of public attributes.
  • NOM — total methods (public + private).
  • WMC — weighted methods per class.