Code Metrics, the Weight Watches Points system for code improvements

A few years ago I was trying to improve my road bike riding skills for a 300 km long bike race called Vätternrundan. I was, to be kind, overweight. I had tried for some years to lose some weight but always faltered with my motivation. It always felt like it was too many kg to lose to really get started so I never made a real effort. I didn’t believe in Weight Watches and other weight loss programs but my wife convinced me to try it. I got a correspondence program and started reading the material. Nothing really appealed to me and I still felt like the task was overwhelming. But I started to keep the diary as suggested. I followed the program but ate a few points over the recommendation and felt quite bad about it. I kept up updating the diary and I started to trend my points intake and my weight. Low and behold, two weeks in I had lost 2kg! My motivation grew and I started to look at the points intake and weight loss trends avidly.  20 weeks later and I had lost 26kg!

So can you use the same kind of motivation for code improvements? Yes I think so.

For years I have tried to apply “The Boy Scout Rule”, formulated by Uncle Bob (Robert C Martin), on my code base:

 “Always check-in a module cleaner than when you checked it out."

If you follow this rule your code base should little by little become better and the problems will wither away over time just like my weight loss. If you have a large code base with lots of problems it can feel like an insurmountable task to fix all the problems and you push the change off. Maybe you say, next major change request I will rewrite it without the problems. But there is very seldom the time or the money too really do a full rewrite so you keep pushing it off. What if we could use Code Metrics to motivate code improvements the same way as Weight Watches use the Points system for motivating weight loss?

I believe you can use Code Metrics to motivate developers to follow “The Boy Scout Rule” in their code base.

In coming posts I will illustrate how to use code metrics and visual tools to keep developers motivated for continuous code improvements.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s