3 ms·
Note that their bad example is comment-every-line style just like GP's example. No-comment self-documenting code is largely a backlash to this style, which is
by Izkata 5y ago
Note that their bad example is comment-every-line style just like GP's example.
No-comment self-documenting code is largely a backlash to this style, which is how introductory coding courses teach (taught?) was the right way to do comments. For a lot of programmers who first started in in one of these courses it tended to stick because they were never taught another way.
- t0suj4 5y agoMy algorithm for commenting is simple: If I don't understand what a line of code does, I delete it. If the behavior stays the same then it shouldn't have been there in the first place. If removing the line breaks something I put it back and add a comment explaining why it belongs there.
- alanbernstein 5y agoThat seems... Dangerous