Favor Readable Code Over Idiomatic Code
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.
|
|
|
||
|
|
|||
|
|
|
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