CQM-GodClassRoutine

Classes shall not have too many routines

Required inputs: RFG

Any class that contains more than 50 routines is a violation of this rule.

Motivation

A god class has a very wide interface due to the many routines with a high visibility compared to the class itself. This width means that both their use and maintenance are excessively costly. Often such classes have very little cohesion, i.e. the class is more an over-sized container of different abstractions and functionality than a unified concept with data and routines accessing it.

This rule is based on the CQM Quality Indicator: Gottklasse (Methode) (p. 198-200).

Reference

Simon, Frank/ Seng, Olaf/ Mohaupt, Thomas (2006): Code-Quality-Management: Technische Qualität industrieller Softwaresysteme transparent und vergleichbar gemacht, 1st ed., Heidelberg, Germany: dpunkt.verlag GmbH.

Possible Messages

Key

Text

Severity

Disabled

to_many_routines

This class contains {val} routines, it should contain no more than {max_number_of_routines} routines.

None

False

Options

count_constructors

count_constructors : bool = False

Count constructors of class.
 

count_deleted

count_deleted : bool = True

Count deleted routines of class.
 

count_destructors

count_destructors : bool = False

Count destructors of class.
 

count_operators

count_operators : bool = True

Count operators of class.
 

count_private

count_private : bool = True

Count private members of class.
 

count_protected

count_protected : bool = True

Count protected members of class.
 

count_public

count_public : bool = True

Count public members of class.
 

count_template_routines

count_template_routines : bool = False

Count template routines of class.
 

include_structs

include_structs : bool = False

Whether structs are to be analyzed.
 

include_template_classes

include_template_classes : bool = False

Whether template classes are to be analyzed.
 

max_number_of_routines

max_number_of_routines : int = 50

Maximum allowed number of routines in a class.