New Metrics CD and RLF Proposed to Fix Cyclomatic Complexity's Testing Blind Spots
A software developer has proposed two new code-quality metrics — Coverage Difficulty (CD) and Responsibility Load Factor (RLF) — to address limitations in the widely used Cyclomatic Complexity (CC) measurement. CC, a heuristic dating to the 1970s, treats nested and parallel branches identically, which can underestimate the actual effort required to write exhaustive tests. CD estimates the true number of test cases needed by multiplying nested branch weights and summing parallel ones, rather than simply counting branch points. RLF is calculated by dividing CD by CC, with values significantly above 1.8 signaling that a function is far harder to test than its CC score suggests. The author also recommends refactoring high-RLF functions into flat lookup tables, a pattern they call Cross-Mapped Programming, to reduce hidden testing complexity.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in