CQM-PotentialPrivacyRoutine

Routines that could have more private scopes

Required inputs: RFG

This rule considers routines that are protected but could be private. A routine can be private if it is either not used or overridden by any routine in a subclass. Or if it overrides or implements a routine from a superclass. Any routine that could be private is a violation of this rule.

Motivation

Routines implement the behavior of a class and form its interface at the same time. The larger (more extensive) an interface is, the more difficult/expensive it becomes to understand and modify the class. Therefore, this interface should be kept as small as possible.
This problem pattern focuses on those routines of the interface that are to be made available to subclasses. This part is also to be kept minimal. This requirement is violated for an interface if an interface routine is not overridden or called in any subclass and if the interface routine itself does not override or implement any routines of a superclass.

This rule is based on the CQM Quality Indicator: potenzielle Privatsphäre (Methode) (p. 271-274).

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

protected_could_private

This routine is protected but could be private.

None

False

Options

count_template_routines

count_template_routines : bool = False

Count template routines of class.
 

include_template_classes

include_template_classes : bool = False

Whether template classes are to be analyzed.