Slide 13
Slide 13 text
jgs
Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 13
§ Cyclomatic Complexity. It is a quantitative measure of the number of
linearly independent paths.
§ Paths occur when "while,” "for,” "if,” "case," and "goto" keywords appear
within the function.
§ If the source code contained no control flow statements (conditionals or
decision points), the complexity would be 1
§ If the code had one single-condition IF statement, there would be two paths
through the code: one where the IF statement evaluates to TRUE and
another one where it is considered to be FALSE.
§ Two nested single-condition IFs, or one block with two conditions, would
produce a complexity of 3.
Function Metrics