Chidamber & Kemerer
Shyam Chidamber and Chris Kemerer proposed a suite of six object-oriented design metrics in their 1994 paper "A Metrics Suite for Object Oriented Design" [1], covering complexity, inheritance, coupling, and cohesion at the class level.
Chidamber & Kemerer Metrics¶
| Name | Acronym | Understand Metric ID |
|---|---|---|
| Weighted Methods per Class | WMC | CountDeclMethod |
| Weighted Methods per Class (complexity-weighted) | WMC | SumCyclomatic |
| Depth of Inheritance Tree | DIT | MaxInheritanceTree |
| Number of Children | NOC | CountClassDerived |
| Coupling Between Objects | CBO | CountClassCoupled |
| Response for a Class | RFC | CountDeclMethodAll |
| Lack of Cohesion in Methods | LCOM | PercentLackOfCohesion |
Notes:
- Chidamber & Kemerer's original WMC definition weights each method by a complexity metric of the implementer's choosing, without specifying one. Understand offers two interpretations: CountDeclMethod counts methods unweighted (every method has weight 1), while SumCyclomatic weights each method by its own Cyclomatic Complexity before summing, which is the more common weighting used in practice.
- CountDeclMethodAll is also tagged as Lorenz & Kidd's Number of Methods (NM), since RFC's simplified form (methods in the class, ignoring the methods it calls elsewhere) and Lorenz & Kidd's NM count the same thing.
- PercentLackOfCohesion also goes by LCOM2 — a normalized, percentage-based cohesion formula commonly used in tools (100% minus the average share of methods that touch each attribute). That is not Chidamber & Kemerer's own LCOM from their 1994 TSE paper, which instead counts dissimilar method pairs minus similar method pairs (floored at zero) — a raw integer, not a percentage; Understand uses the LCOM2 form for the suite's cohesion slot.
References¶
- Chidamber, Shyam R., and Chris F. Kemerer. "A Metrics Suite for Object Oriented Design." IEEE Transactions on Software Engineering, vol. 20, no. 6, 1994, pp. 476-493.
Chidamber & Kemerer Plugins¶
| Name | Kind |
|---|---|
| All Methods | Metric |
| Coupled Classes | Metric |
| Derived Classes | Metric |
| Max Inheritance Tree | Metric |
| Methods | Metric |
| Percent Lack Of Cohesion | Metric |
| Sum Cyclomatic Complexity | Metric |