Slide 20
Slide 20 text
Function Metrics
• Cyclomatic Complexity. It is a quantitative measure of the number of linearly independent
paths.
• P
a
ths occur when "while,” "for,” "if,” "c
a
se,"
a
nd "goto" keywords
a
ppe
a
r within the function.
• If the source code cont
a
ined no control
f
low st
a
tements (condition
a
ls or decision points),
the complexity would be 1
• If the code h
a
d one single-condition IF st
a
tement, there would be two p
a
ths through the
code: one where the IF st
a
tement ev
a
lu
a
tes to TRUE
a
nd
a
nother one where it considers to
be FALSE.
• Two nested single-condition IFs, or one block with two conditions, would produce
a
complexity of 3.
20