Skip to main content
Ben Nadel at CFUNITED 2009 (Lansdowne, VA) with: Mike Oliver
Ben Nadel at CFUNITED 2009 (Lansdowne, VA) with: Mike Oliver

Favor Readable Code Over Idiomatic Code

By
Published in

Right now, I work on a team that manages and maintains a large legacy system. This means that I only spend a small amount of time writing new code; and, a very large amount of time trying to understand and improve existing code. But, this isn't so unusual. Eventually, all greenfield projects becomes brownfield projects; and, over the lifetime of an application, we will end up spending more time in maintenance mode than anything else (at least, if you're lucky enough to have successful software).

Of course, I'm not the first person to say this - it's a well known fact that we spend more time reading code than writing it. I only bring this up in order to underscore the importance of readability. And to suggest that you favor "readable" code over "idiomatic" code - when the two are not the same thing.

Idiomatic code builds on the wisdom of the past. Readable code believes in the beauty of the future. These two concepts are not in opposition; and will, in fact, overlap to a large degree. But, when code is "readable" simply because it is idiomatic, then this is an opportunity for improvement.


 
 
 

 
Favor readable code over idiomatic code.  
 
 
 

It's not easy to understand where that line is. And, I'm not suggesting that code always be "dumbed down" for novice developers. I'm only suggesting that there are going to be opportunities to become the rising tide that lifts all boats. And, to embrace those opportunities rather than fight them. And, if you find yourself saying, "Because that's how XYZ developers do it," take a step back and, as nothing more than a thought experiment, consider an alternate perspective.

Reader Comments

I believe in love. I believe in compassion. I believe in human rights. I believe that we can afford to give more of these gifts to the world around us because it costs us nothing to be decent and kind and understanding. And, I want you to know that when you land on this site, you are accepted for who you are, no matter how you identify, what truths you live, or whatever kind of goofy shit makes you feel alive! Rock on with your bad self!
Ben Nadel