Unfortunately, most metrics in software miss the mark. At best, measuring any sort of development activity causes developers to focus on improving that metric at the expense of other valuable activities. At worst, it causes developers—consciously or not—to game the system.
Let's consider the metric of code coverage. Suppose the department sets a policy that any new code that goes into the system must have 80% code coverage. The managers get their beloved data, and the quality of the code will certainly improve—right?
Now let's assume the developers make an honest effort to meet that goal. They may even go so far as to test all of their getters and setters.
Great, they met the goal, but is the quality of the code improved? Not necessarily. Most would agree that testing getters and setters is a waste of time. Further, just because code is covered by a test does not mean that the test is meaningful.
What about measuring the number of features shipped? This may work fine in the short term, but it definitely does not take into account code quality, or the value of said features to the customer.
The truth is, good developers thrive when granted autonomy. Setting arbitrary metrics for them to meet undermines whatever autonomy you claim to extend. It takes the "self" out of self-organized teams. It follows then that, ideally, metrics should grow within the team rather than be imposed by management.
Personally, the only metric I trust is a gut feeling. I call it the Happiness Metric.
To convert my gut feeling into hard data, I take a short survey every few weeks with prompts like the following, rated on a scale from 1 to 5:
- I delivered value to my customers
- I focused on quality
- I worked at a sustainable pace
- I was intellectually engaged
- I was happy
For individuals and teams, these questions will cause introspection and serve as a discussion point. They will help you evaluate whether you worked on the most important thing for your customers.
It may not be exactly what management is looking for, but I don't know of any better way to measure the productivity of a team.
I'd love to hear about metrics that have worked for your teams. Follow me on twitter @justin_hewlett.