Freigeben über


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

Comments