Thursday, December 10, 2009, 02:54 PM - Design concepts
I came across this interesting metric called "Cyclomatic complexity" at work today. It is measurement of how complex a function is in terms of the logical branches it has.The formal definition as in Wikipedia is quite mathematical and not in tune with the thinking of the like minded people visiting my blog.
A far less and simple definition can be found at this code project article which says to calculate this metric:
• Start with 1 for a straight path through the routine.
• Add 1 for each of the following keywords or their equivalent: if, while, repeat, for, and, or.
• Add 1 for each case in a switch statement.
There is another defintion as seen in Ncover's site which says
The cyclomatic complexity value is the maximum number of test cases needed to get 100% branch coverage, and the minimum number of test cases needed to exercise every path through a method, so it provides a good way to tell how well-tested a method is.
Happy cyclomatting.//




( 3 / 137 )

Calendar




