Good code takes three rewrites because your understanding changes
Quote
three times. The first, the first time is not going to work. The second time is going to work, but it's not great. And the third time is when you fully,
Episode 235: Rodecaster Disaster (episode page, opens in a new tab) 00:36:58 (play audio from this timestamp, opens in a new tab)
Voice-matched
Summary
Recalling advice he credits to the author of a famous computer science algorithms book, Dave says proper code takes three writes. The first won't work, the second works but isn't great, and the third is when you fully get it. The code isn't what changes; your understanding of the problem is, until the code maps to the problem domain itself.
Not in the audio. Dave couldn't remember who said it ('the guy that wrote the famous algorithm book'), so the original source is unattributed. The quote starts right after an Unknown cue ('get proper code, you need to rewrite it') that sets up 'three times'.
Also said
Episode 235: Rodecaster Disaster (episode page, opens in a new tab) 00:37:30 (play audio from this timestamp, opens in a new tab)
As you understand the problem better, you, you begin to write code that more accurately maps to the problem domain itself.
Voice-matched