item is m a inly a bstr a ct (interf a ces, a bstr a ct cl a sses – extensible but not directly us a ble); or (b) it is m a inly concrete (implement a tions – directly us a ble but less extensible). • It is a v a lue between 0 a nd 1: 0 ( a concrete cl a ss or a p a ck a ge with only concrete cl a sses) 1 ( a n a bstr a ct cl a ss/interf a ce or a p a ck a ge with only a bstr a ct cl a sses/interf a ces) 3
item is m a inly used by others (st a ble – h a rd to ch a nge); or (b) it m a inly depends on other items (in-st a ble – ch a nge a ble). • It is a v a lue between 0 a nd 1: • 0 only incoming dependencies to • 1 (only outgoing dependencies). 4
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. 8
Testability Cost and Effort is less 10-20 Complex Code Medium Testability Cost and effort is Medium 20-40 Very complex Code Low Testability Cost and Effort are high >40 Not at all testable Very high Cost and Effort Cyclomatic Complexity 11
[email protected] Fall 2025 Copyright. These slides can only be used as study material for the class CSC305 at Cal Poly. They cannot be distributed or used for another purpose.