Blog

CITcon 2007: Code Metrics

Notes from the Code Metrics session:

What kind of code metrics do you collect?

  • Complexity
  • Coverage
  • Dependencies
  • Documentation
  • Code Style
  • of unit tests, line of code

  • Code Duplicates
  • Volatility
  • Velocity

Great first metric is volatility or churn: the number of commits in a specific area contracted to complexity. Volatility comes from version control data, complexity is produced by a script. Gives you a solid feel of where potential bugs are, typically where there are lots of commits in a complex area as measured by your complexity tool.

“Cyclomatic Complexity” apparently has lots of research behind it proving that high complexity leads to bugs, and that this is really good spot to look at in reducing code.

Metrics are much more valuable when you have them in a historical context. Hackystat (a favored tool of mine!) gets a plug. Sabre has developed a home grown system that parses reports and adds them to Mysql… They could use HackyStat for similar function.

Demo/introduction of Panopticode. Visualizes metrics with the goal of making the use of metrics simple and ubiquitous.

I think Ill be looking very closely at Panopticode, and how visualizations can help make metrics more relevant to management and teams, versus just some charts that are never acted on.