We need to reconsider our priors on code readability.
Humans, compared to agents, are pretty slow at understanding large quantities of text. So in the old days, readability was important so the human could efficiently grok what was going on.
So readability now comes down to:
1. Can a human, if needed, jump in and understand the code
2. Does the code use the same domain language as the human describing the code?
1 helps with observability and the occasional spot checks you need to do on important PR's. 2 helps the agent translate the words you use into code changes.
In other words, readability is now a nicety, not a necessity.
The way agents 'read' code is different - good agents are all about gathering data about how the code works. They'll prod around with it, execute parts of it.
So 'readability' to agents really means 'verifiability'. How easy it is to mess about with that code to see it working.
Let's take this scenario:
- You have a huge module in your codebase that uses all sorts of complex performance tricks
- It has 100% test coverage
A talented human would need an hour or two to get comfortable working in that module.
An agent needs zero time. They verify it with the tests, poke about a bit, and they're good to go.
The takeaways:
- When judging a module (or a codebase), don't think about how easy the code is to read
- Instead, think about how easy it is to verify
- Design your codebase so modules can be tested and verified independently
- Feel free to sacrifice a bit of readability for performance
- Cyclomatic complexity and function size don't matter to agents