Sunday, March 06, 2005

Code Complexity

Mark Miller's post on code complexity is a great discussion on code metrics. "Cyclomatic complexity" is a nice starting point for looking at how ugly software can be, but Mark discusses how "CC" isn't a wide enough picture. I like the detailed values he gives metrics in his post, but I'd disagree with his thoughts on weighting comments. Yes, comments must be read and maintained, but if you're using comments as a "why" instead of "how" (again, read your McConnel!), then comments help to reduce complexity, not increase it. Overall, though, this is a very minor quibble in the context of the great depths to which he goes for weighting code complexity. Check out the tools referenced in his post. DXCore is free, as is the plugin for generating metrics. Unfortunately, the zip file pointed to on SourceForge appears to be corrupt. Hopefully that will be fixed quickly, because I'd like to get a fast look at this toolset. I've also been very happy with Anticipating Minds' devMetrics , a nice tool for a quick exposure of cyclomatic complexity. Their Comunity Edition is a free plugin for Visual Studio. (Hat Tip: Alex Lowe)

No comments:

Subscribe (RSS)

The Leadership Journey