Jens Schauder is software developer since 1997. He loves software development for the constant challenges and constantly changing environment. A great chance to learn and teach. He is also blogger, author of various articles and speaker at conferences. Jens is a DZone MVB and is not an employee of DZone and has posted 86 posts at DZone. You can read more from them at their website. View Full User Profile

Clean Code is just a Crutch

  • submit to reddit

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.


Published at DZone with permission of Jens Schauder, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Shankar Vasudevan replied on Wed, 2011/09/14 - 5:36am

could not agree more :)

Robert Saulnier replied on Wed, 2011/09/14 - 6:18am

The only things that count in the end are measured in dollars, euro and yen.
I disagree with the above statement. How does this apply to open source software?

Tom Wheeler replied on Wed, 2011/09/14 - 9:17am

I'm not sure whether you forgot about risk or intentionally didn't include it in those three bullet items.  But just like developer time and opportunity cost, risk also has a price. 

If, for example, you have code with a latent synchronization problem and choose not to fix it, you're betting that the cost of correcting it is greater than the damage it can cause (i.e. likelihood of damage * total cost of recovery). 

Whether you identify and fix problems in your code is up to you, but IMHO you ought to evaluate the risk in addition to the performance, maintainability and flexbility considerations you listed.

Jens Schauder replied on Wed, 2011/09/14 - 11:38am in response to: Robert Saulnier

I was limiting my thought to professional work i.e. work that I want to get paid for.

 There is the special case of Open Source Software that somebody pays for where he actually does a code review before deciding if to pay and how much. Didn't happen anywhere in my vicinity. 


When working on a free project, just for fun, for training or for fame, it becomes a whole different story.

Jens Schauder replied on Wed, 2011/09/14 - 11:48am in response to: Tom Wheeler

@Tom Wheeler the list of bullet items wasn't intended to be exhaustive.

John David replied on Thu, 2012/01/26 - 3:12am

But clean code is not a substantive – i think that’s what Jens wanted to say … but I suppose that clean code should be the only code written  – we have to stop those dudes who just glue their changes in action performed methods again and again… only because that was in that moment the cheapest/fastest solution … because this would only be the fastest solution for them…

Java Eclipse

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.