Cyclomatic complexity: Difference between revisions

Content deleted Content added
No edit summary
Line 34:
In general, in order to fully test a module all execution paths through the module should be exercised. This implies a module with a high complexity number requires more testing effort than a module with a lower value since the higher complexity number indicates more pathways through the code. This also implies that a module with higher complexity is more difficult for a programmer to understand since the programmer must understand the different pathways and the results of those pathways.
 
One would also expect that a module with higher complexity would tend to have lower [[cohesion]] (less than functional cohesion) than a module with lower complexity. The possible correlation between higher complexity measure with a lower level of cohesion is predicated on a module with more decision points generally implementing more than a single well defined function. However there are certain types of modules that one would expect to have a high complexity number such as UI modules containing source code for data validation and error recovery.
 
==Example Graph==
[[Image:McCabeMetric.gif]]