Shaykatc's WebLog

McCabes Cyclomatic Complexity

This is a cool concept that Steve discussed briefly today. The discussion was around how to do code coverage effectively, and Steve brought up the idea of Mccabes cyclomatic complexity. This is basically a stat that measures the complexity of a particular function. It measures this by checking the number of branches in code. A method with no branches has complexity of one, a method with 1 branch has complexity of 2 etc etc. Anyway tools can measure the complexity of particular functions. As it was discussed at our meeting, studies have been done charting bugs found in a function w.r.t its cyclomatic complexity and apparently the number of bugs spikes up hard after complexity hits 13. Pretty cool concept, fun to read about. Please note the author expresses no expertise in this area, but just wanted to share a neat new idea/discussion with the general community.

Shaykat

Published Wednesday, March 16, 2005 3:15 PM by shaykatc
Filed under:

Comments

 

Karl said:

AnticipatingMinds have a VS.Net plugin for measuring Mccabes cyclomatic complexity...with a free community edition available. Haven't used it too much, but thought some people might wanna play with it in their code:
http://www.anticipatingminds.com/Content/Products/devMetrics/devMetrics.aspx

Karl
March 16, 2005 3:32 PM
New Comments to this post are disabled

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker