posts - 103, comments - 4, trackbacks - 37

My Links

News

Tag Cloud

Archives

Cyclomatic Complexity

I was introduced to the concept behind CC a while ago, as well as how to measure it, but I never saw any hard numbers about what was an acceptable complexity - until now. Bruce Mcleod has a very nice post that includes a table from Carnegie Mellon Software Engineering Institute about just that. Basically, if you're under 10, you're golden. Up to 20, you're OK. Up to 50 - that's complex. Over 50 and you're in trouble.

Bruce also points out something I missed. If you're into unit testing, measuring your CC gives you the minimum number of tests you'll need to fully exercise your code. That means to achieve 100% code coverage, you need at least as many tests as your project's total CC. Cool!

I was on a project that used some existing code, and I ran some metrics against it. Do you think it was bad that one of the methods had a Cyclomatic Complexity of 406?

Print | posted on Friday, July 22, 2005 3:46 PM |

Feedback

Gravatar

# re: Cyclomatic Complexity

Hi Joel,

I'm glad you liked my post.

Bruce McLeod
12/8/2005 7:28 PM | Bruce McLeod
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 

Powered by: