Weighted Methods per Class
From Maisqual Wiki
If all method complexities are considered to be unity, then WMC = n, the number of methods.
WMC relates directly to Bunge's definition of complexity of a thing, since methods are properties of object classes and complexity is determined by the cardinality of its set of properties. The number of methods is, therefore, a measure of class definition as well as being attributes of a class, since attributes correspond to properties.
- The number of methods and the complexity of methods involved is a predictor of how much time and effort is required to
develop and maintain the class.
- The larger the number of methods in a class the greater the potential impact on children, since children will inherit all the
methods defined in the class.
- Classes with large numbers of methods are likely to be more application specific, limiting the possibility of reuse.
- Original paper from Chidamber and Kemerer : A Metrics Suite for Object Oriented Design
- Subramaniam et al. compared it to other metrics in some contexts: Empirical Study of CK metrics for object-oriented design complexity: Implications for software defects
- ↑ A Metrics Suite for Object Oriented Design
- ↑ Check the Complexity definition in the glossary.
- ↑ Complexity is deliberately not defined more specifically here in order to allow for the most general application of this metric. It can be argued that developers approach the task of writing a method as they would a traditional program, and therefore some traditional static complexity metric may be appropriate. This is left as an implementation decision, as the general applicability of any existing static complexity metric has not been generally agreed upon. Any complexity metric used in this manner should have the properties of an interval scale to allow for summation.