Code Readability in the age of AI
2026-07-28
The old joke about Perl was "write-once, read never" due to it's many ways to do the same thing. Over time the syntax could become unrecognizable to even the person who wrote it.
With the rise of large amounts of generated code, code readability is more important now than ever. Your senior engineers may be reviewing code all day long and writing little of it themselves.
Reading and debugging code is often harder than writing it in the first place. Instead of building up the mental model in your head as you go, you have to disect what is there into pieces that make sense. This idea is expressed by Kernighan's law first introduced in The Elements of Programming Style (1974).
Debugging is twice as hard as writing the code in the first place.
- Kernighan's law
Some have tried to quantify code complexity with Halstead's Software Metrics or SonarSource Cognitive Complexity. These are quantified ways of looking at the complexity of code and can be valuable tools to automate code review, though I think there is also a feeling or maybe a dread one has when reading the code that will tell you whether it is readable or not.
With any large amount of source code, and especialy code you are not familiar with such as legacy code or code from a generator like AI, readability becomes a large factor in how long it takes to debug or verify the software.
Programming languages that are easier to read like Python, Ruby or Kotlin are also easier to debug and verify than code that is harder to read like Rust or Haskell. Then in the middle somewhere are languages like Java and Javascript.
In general, higher level languages with less punctuation in the syntax and more semantic words instead of abstract symbols are easier to read than those with the opposite. These langauges tend to be ones that are dynamically typed with just-in-time compilation instead of ahead-of-time, so they may also be a little slower.
Curiously this readability also closely translates into less token usage by AI. Though contrary to what I think of as human readabiltiy, these tests show the highly abstract syntax of Perl and Haskell are more easily dealt with by the AI in tokens.
In the end we're all probably trying to avoid reading and writing Assembly language.
While it is usually best to limit the amount of code you need to produce for a given result, as less code is more maintainable and faster to write by hand or by robot, If you must produce lots of code, the choice of programming language can make a great difference in how well you can read and maintain that code.
Photo by Zuzana Kacerova on Unsplash