3 ms·
I've always used this approach to coding : 1. Write in English what you intend the code to do, as comments. 2. Progressively write code to do what you said you
by dboreham 9y ago
I've always used this approach to coding :
1. Write in English what you intend the code to do, as comments.
2. Progressively write code to do what you said you would do above until it is all done.
3. Leave the comments there to explain what it does.
I've worked this way since I got to use comments (originally I coded in hex, computing negative branch offsets in my head as I went -- possibly this explains why I'm such an curmudgeon about requiring comments that explain any non-obvious code's purpose and intentions).
(Yes there is an issue with consistency between comments and code, especially if code is changed over time. Better to fight that problem I believe than to have no information from the original developer as to wtf they thought they were doing.)