2. Overview
• Introduction
• Overview of Cyclomatic Complexity
• Theoretical assumptions that reasoned for
objection
• Modification Suggested
• Conclusion
Martin Shepperd, Software Engineering Journal March 1988 2
3. Introduction
‘Halstead’s Software Science’
Cyclomatic Complexity approach of
MacCabe
Martin Shepperd, Software Engineering Journal March 1988 3
4. Overview of the Cyclomatic
Complexity Metric
Control Path is the indicator
v(G) = e - n + 1 (1)
v(S) = e - n + 2p (2)
IF X < 1 AND Y <2 THEN
Case statements (n-1) n is the no. of cases
Upper limit v(G)=10 suggested with
some relaxations.
Martin Shepperd, Software Engineering Journal March 1988 4
5. Controversy (1)
On the basis of the counting rule
Myers interval
Thus the failure of cyclomatic complexity to count ELSE branches is
only a serious deficiency if the metric is intended to Capture
complexity of comprehension.
Martin Shepperd, Software Engineering Journal March 1988 5
6. Controversy (2); on count of case
Hansen (count case contribution to the complexity should be one)
raises the question on the count of the
cases
Other have suggested as log2(n)
Martin Shepperd, Software Engineering Journal March 1988 6
7. Controversy (3); (modification)
Hansen proposed 2-tuple cyclomtic
complexity(defined to be arithmetical operators, function and
subroutine calls, assignments, input and output statements and array
subscription).
Discarded by Baker and Zweben as the problem to comparision.
Martin Shepperd, Software Engineering Journal March 1988 7
8. Controversy (4) ; (modification)
Stetter suggested cyclometic flow
complexity metric. (flow of data is also
considered her)
Martin Shepperd, Software Engineering Journal March 1988 8
9. Controversy (5)
Based on no. of structured
With increase of program structure
cyclometic complexity aslo increases.
Martin Shepperd, Software Engineering Journal March 1988 9
10. Controversy (6) ; a critical one
Evangelist reports that the application
of only 2 out of 26 of Kernighan and
Plauger’s rules of good programming
style invariably results in a decrease in
cyclomatic complexity.
Martin Shepperd, Software Engineering Journal March 1988 10
11. Conclusion
Much of the difficulty stems from the fact that McCabe was originally thinking in
terms of Fortran, whereas most of these difficulties arise from other
languages, some of them more recent, such as Ada Here one has to contend
with problems such as distinguishing between
‘IF y = 1 ORy = 3’ and
IF y = 0 OR ELSE x/y>1.
the mapping from code to a program graph is ambiguous.
Martin Shepperd, Software Engineering Journal March 1988 11