The skinney on complexity
Code metrics can be useful if they are applied correctly. Productivity, for example, is an area where code metrics have been abused. These valuable measurements, however, can be effective in objectively spotting complexity. Since complexity usually correlates to defects, doesn’t it make sense then to measure and track complexity within a code base?
The third article in IBM developerWorks’ hip series “In Pursuit of Code Quality” explores Cyclomatic Complexity and how one can obtain it via JavaNCSS. Check out “Monitoring cyclomatic complexity” and if you have any thoughts, questions, or concerns, check out the “Improve Your Java Code Quality” forum!
| Related odds and ends | ||
|---|---|---|
Friday 31 Mar 2006 | Articles
[...] Unless one effectively makes use of code metrics, they are, arguably, useless data points. Luckily, it’s rather easy to employ these objective measurements of code quality when it comes to refactoring. Cyclomatic complexity, for instance, is excellent at spotting complex code, which can then be refactored using the Extract Method technique. [...]
[...] Neat-o tools like PMD also make it easy to spot code which should be reviewed. Because complexity metrics, like Cyclomatic complexity, strongly correlate to defects, if PMD flags a method with excessive values, taking the time to figure out why the complexity is there and determining if there is a path to mitigate it will almost certainly pay dividends in the future. Dig it? [...]