Code is Still Harder to Read than Write - Part 1

I've posted this article recently, but it got me thinking about why code is harder to read than to write. So, I will post it again, to make your life easier and explain why I think that code is still harder to read than write, even all these years later. Here's the article:

Things You Should Never Do, Part 1

The title of this post seems counter-intuitive because we think of reading and writing in relationship to human language, but programming languages are not like human language.

What are the important differences? Here is the main one:

Programming languages can't be read aloud.

So when we talk about 'reading code' we're using 'reading' in a purely metaphorical sense. When you 'read' code you don't actually read it - you're looking at it and trying to make sense of what it does.

This is nothing like reading a book, paragraph, or sentence written in human language.

When you review code you study, you re-read, you look things up. You jump around from file to file. You may consult web pages. Even in programming languages you are familiar with and with a business domain you know, these tasks can be time consuming.

You're trying to 'read' something that can't be read, across many files, and trying to ascertain the author's intent not just comprehend a sentence.

An equivalent would be trying to read in a language where you had to look up every third word, every time you read something because:

  1. Every author used the language in a novel way. AND
  2. Every page of a book was put in a different file and they were constantly referencing each other and not in order.

It would be hard. And it would not really be reading. That's what 'reading' code is.

  • Enjoyed this post?
    Consider sharing it.