Skip to main content
NPA (Number of Public Attributes) counts public fields/properties exposed by classes and interfaces in a file. A high NPA usually signals weak encapsulation — internal state leaking outside the type.

What mehen emits

What counts as “public”

The exact rule is language-specific:

How to read it

A “few” public attributes is usually fine. Many can mean:
  • Data classes / records: NPA = number of fields is expected and benign.
  • Property bags or “god objects”: NPA grows past 10 — refactor candidate.
Read NPA alongside NPM. A class with NPA much greater than NPM is a struct in disguise; a class with NPM much greater than NPA is encapsulating state behind methods.

References

  • Lorenz, M. & Kidd, J. (1994). Object-Oriented Software Metrics: A Practical Guide. Prentice Hall.
  • Chidamber, S. R. & Kemerer, C. F. (1994). A Metrics Suite for Object Oriented Design. IEEE TSE 20(6): 476–493. DOI.
  • Briand, L. C., Daly, J. W. & Wüst, J. K. (1998). A Unified Framework for Coupling Measurement in Object-Oriented Systems. IEEE TSE 25(1): 91–121. DOI.

See also

  • NPM — number of public methods.
  • NOM — number of methods (public + private).