Analiz...ributes(3pm)

πŸ“¦
version 1.25.5 Β· 4 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

ok so this is Analizo::Metric::NumberOfPublicAttributes β€” the Number of Public Attributes metric, aka NPA if you're in a hurry. it's a Perl module that lives in the User Contributed Perl Documentation section of your man pages (you know, the 3pm girlies), and it does exactly one thing and does it well: it counts the public attributes of a class. that's it. that's the whole job. πŸ’…


✨ DESCRIPTION ✨

the calculation here is based on an article, bestie β€” and what it's calculating is literally just the number of public attributes of a class. one metric, no cap.

  • Article: Monitoring of source code metrics in open source projects by Paulo Roberto Miranda Meirelles πŸ“š

and here's the adaptation of the paragraph in that article about Number of Public Attributes, because honestly it explains the whole vibe better than I ever could:

It measures the encapsulation. The attributes of a class must only serve to the functionalities of itself. Thus, good programming practices recommend that the attributes of a class must be manipulated using the access methods (Beck, 1997), the attributes of a class must be private, indicating that the ideal number for this metric is zero.

so yeah. short version: this metric is a vibe check on your encapsulation πŸ¦‹ it's measuring how locked-down your class is. the tea is that a class's attributes should only be serving that class's own functionality β€” nothing else, nobody else, mind your business βœ‹

and good programming practices (hi Beck, 1997 πŸ‘‹) say you should be reaching your attributes through the access methods, not grabbing them directly. attributes should be private, which means…

the ideal number for this metric is literally zero πŸ’€

yes bestie, zero. if this metric is anything above 0 for you, it's giving "opened the fridge and everything fell out" energy. go make those attributes private, you got this 🫢


ok that's the whole page! no hidden flags, no secret options, no trap doors β€” just one metric and one very strong opinion about encapsulation.

perl v5.40.1 Β· 2025-12-13 β€” mwah, happy metric-watching, bestie, go get that zero πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from