When anaylizing some cyclomatic complexity (measures the number of linearly-independent paths through a program module), I was thinking to myself about where I want my thresholds to be. Where to I say “this is simple enough” or “I definately need to refactor this”.
So here is my conclusion:
- 1–10 Simple enough. Don’t change. Little risk involved.
- 11–20 Should consider refactoring. Moderate risk involved.
- 21–40 Definate refactoring needed here. Risk is too high.
- > 41 What was I thinking? Throw this away and start over.
I won’t find anything in the greater than 41 range, but if I were to find anything, I’d definately throw it away.