Use competition to boost code quality

Most Java developers know static code analysers like Checkstyle, Findbugs, or FXCop for the .Netters amongst us. And these tools are extremely helpful for pointing out the spots in your code that may need some improvement.

However, people must be motived to use such tools, and in real-life this is not always the case. After all, quite often people are not really interested in code quality. Especially since for most non-programmers code quality is something that happens ‘behind the scenes’. “We will worry about code quality when we have time for it… now we’ve just got to get our app up and running, right?”. Wrong!

Quality matters, it will make you a happier programmer both in the short run and in the long run. You will spend less time working on high quality code than on low quality code. It makes your application more durable. Software that lasts, that is easy to understand, flexible to use. But not everybody has this high quality bling-bling mindset. So, how do you motivate people to care about quality?

The answer is: let emotion kick in!

The lessons that can be learned from good presentations, enjoyable movies, and successful marketing strategies is that emotion makes people care. Remember your greatest movie. Isn’t it true that you can really identify with the main characters? Didn’t you forget the time when you were watching that great presentation? Read for example Made To Stick to learn about 6 elements of why some ideas survive and others die.

So, how to make code quality emotional? Should we all be crying? Laughing? Perhaps… but there are more options…

One of the things that works extremely well on the project I am currently working on is using competition. We use Hudson as our continuous integration server. Hudson allows you to use plugins to enhance the capabilities of Hudson. One of these plugins we use is the “Continuous Integration Game plugin“. This plugin gives you positive scores for successful builds, passing unit tests, fixing problems, etc., and it awards you negative points for breaking the build, failing unit tests, introducing warnings etc.

Since we have been using this plugin all team members want to win! They want to get the highest scores, so everybody is looking for opportunities to improve the code, to fix that warning before checking in, or get rid of that duplicate code. And of course, getting the highest score may seem to be the goal for some people, at least a very positive side-effect of this emotional involvement is that code quality does actually get better and better! It is also very good for the team spirit, believe me, lots of laughs!! And you may be wondering, how is this emotional? Well, since all team members get personally involved and are praised personally for high scores, people are emotionally involved.

So my advice: try to use some emotional aspects like a competition in your team so that people really do get motivated to work for example on quality. And even though people may be far more interested in the score, you still have the side-effects of lots of fun and producing high code quality in your team.

  • Share/Save/Bookmark

Leave a Reply