This metric measures the number of public functions for each public class.

A class with too many public functions is generally trying to do too much, either at the interface or implementation level or both. It can be difficult for readers to understand because there is a confusing list of operations. Such classes often lack cohesion and are prime candidates for refactoring.

Classes have wide interfaces for a variety of different reasons, and the appropriate fix is different in each case:

  • M. Fowler. Refactoring pp. 65, 122-5. Addison-Wesley, 1999.
  • R. Martin. The Single Responsibility Principle. Published online.
  • H. Sutter. GotW #84: Monoliths "Unstrung". Published online, 2002.