IfSQ logo


SP-3—Routine Too Complex

Defect Indicators: A program (method, module, routine, subroutine, procedure, or any named block of code) contains more than 10 binary terms in conditional statements.

Risks: Programs containing more than 10 comparisons are more difficult to understand and therefore more difficult to maintain. Programmers are more likely to introduce new errors when they make changes.

A simple way to count the comparisons in a program is to locate the comparison expressions by looking for the keywords that introduce them. This method is based on McCabe's Complexity Metric.

Assessment: Locate and count all binary terms in the program. An easy way to do this is by looking for the keywords and symbols that can precede them in the language you are using. For example:

Mark all the binary terms after the 10th occurrence.



Research Findings: