Understanding Cyclomatic Complexity

#89 - Code That Fits in Your Head - Mark Seemann

Topic 6 of 11

Published May 23, 2022 · Clip 28:35–31:24 (2:49)

Mark explains cyclomatic complexity as simply counting distinct pathways through code: start at one, and increment for every branching (if) or looping instruction. It can be computed mentally during code review. A method with cyclomatic complexity of seven taxes short-term memory like juggling seven mutually exclusive dimensions. He notes older literature considered 20 or 30 acceptable, so his book's main new contribution is dramatically lowering the recommended threshold to seven.