Skip to main content

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.

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

KeyTypeDescription
npaintTotal public attributes across classes and interfaces.
npa.classesintNPA contributed by classes.
npa.interfacesintNPA contributed by interfaces.
npa.class_attributesintSame as npa.classes (alias).
npa.interface_attributesintSame as npa.interfaces (alias).
npa.classes_averagefloatMean attributes per class.
npa.interfaces_averagefloatMean attributes per interface.
npa.total_attributesintTotal NPA in the file (alias of npa).
npa.averagefloatMean attributes per declaration (class or interface).

What counts as “public”

The exact rule is language-specific:
LanguagePublic attribute is…
Java / KotlinA field declared public (or with no modifier in Kotlin classes).
TypeScript / JSA class field without private / protected / # prefix.
PythonA class attribute that does not start with _.
RubyAn attr_accessor / attr_reader / attr_writer declaration (Ruby fields are private by
default).
C#A field with public access modifier (mehen support is partial — see analyzer notes).

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).