Last week I was at the completely awesome SoCraTes conference. It was the first meeting of the German Software Craftsmanship Community. Some of the attendees argued that some day in the future there might be a way to measure the quality of software which in turn would help to argue with management about the need for refactoring and similar actions. I strongly disagree. What amounts to quality in one environment is a lack of quality or even a bug in another environment. So there can’t be a single metric.
Apart from being utopian the idea of a single quality measurement might actually hide a dangerous attitude: The attitude that clean code has a value on its own! It doesn’t. Even if you don’t like it: The only things that count in the end are measured in dollars, euro and yen.
In this sense clean code is only a crutch. We do it in order to get somewhere where we can’t go without, or at least not as easy.
We are convinced that improving our code, and writing tests
- makes us faster (and therefore our work cheaper) in the not to long run.
- makes the code easier to maintain.
- makes it easier to add features tomorrow.
And as long as I’m convinced it is helping with these aims I’ll continue to do so, and so should you.
But if your are doing it just because it is in some fuzzy sense the ‘right thing to do’ you are doing it for the wrong reason and you might be doing the wrong thing.