Code Complete is a frequently recommended book in software development circles. While it is a big volume whose last edition was published almost 20 years ago, I would still recommend it to anyone who is writing code. Many of the principles outlined in it are timeless.

But the most profound realization for me when I read it some years ago was in this sentence.

"Favor read-time convenience to write-time convenience. Code is read far more times than it's written"

Before that sentence, I didn't give much thought to the readability of the code I wrote. If it worked, then that was it. Code was for the machines.

But machines don't need code. In fact, most of the code we write today in high level programming languages are unnatural to a machine. Programming languages exist to make it easier for us to think about and implement instructions to a machine. So programming languages are for our benefit and so is the code that we write with them.

"Is this readable?" and "Is this understandable?" became questions that I frequently asked myself about the code I wrote and reviewed. If the answer was no, I knew the code could benefit from some refactoring.

Prabashwara Seneviratne

Written by

Prabashwara Seneviratne

Author. Lead frontend developer.