Cover image for What is readable code?

What is readable code?

timtrautman profile image Tim Trautman ・1 min read

What makes some code readable and some not?

I recently found myself trying to explain this to a new programmer and the question has stuck with me.

Here's my answer: readable code presents a solution as clearly as possible to other programmers by:

  1. Demonstrating clear intent
  2. Not being longer than it needs to be
  3. Keeping variables and logic "close" to where they're used

But when I think about when I've used the term "readability," though, I've often make assumptions about who code readable to. I'd imagine that beginners to programming, beginners to a new language, and perhaps even experienced programmers without context in a particular domain might find perfectly "readable" code still difficult to understand.

What do you think makes code readable? And how do you think about who your code is readable to?


Editor guide