CQM-PreOrPostnatalCommunication

Number of prenatal or postnatal communications

Required inputs: IR, RFG

The metric counts the number of constructors and destructors in which virtual methods are called directly.

Motivation

Virtual routines are used to enable polymorphism, i.e. sending a message leads to the execution of a routine of the class whose type the object receiving the message has. Polymorphic calls are also possible within constructors, but are often very dangerous there, since the objects receiving the message are not yet fully instantiated (Java) or are of a type that may not be desired/expected (C++).
Basically, prenatal communication becomes particularly dangerous when specifications of the subclass SC are used in the virtual routine if the subclass SC. If this is not the case, prenatal communication doesn't have to lead to errors. However, since such special properties cannot be guaranteed in the long term during maintenance, such constructs should be avoided.

This rule is based on the CQM Quality Indicator: pränatale Kommunikation (p. 274-277).

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

This rule has no predefined messages.

Options

display_name

display_name : str | None = 'Number of prenatal or postnatal communications'

Description of the metric shown in the dashboard. If None, rfg_metric_name is used.
 

max_value

max_value : int | None = 7

Maximum allowed value. None if unlimited.
 

min_value

min_value : int | None = 0

Minimum allowed value. None if unlimited.
 

rfg_metric_name

rfg_metric_name : str = 'Metric.PreOrPostnatalCommunication'

Name of the node attribute storing the metric value in the RFG.