We optimise relentlessly for writing code and almost never for reading it — despite spending far more of our day doing the latter.
Optimise for the reader
Most code is read many more times than it is written, often by someone with none of the context that made it obvious the first time. So I try to write for that reader:
- Names that say intent, not mechanism.
- Functions short enough to hold in your head.
- A comment for the why when the why isn't on the screen.
Reading code well is a skill worth practising on purpose. It's not the overhead around the job. It is the job.