Ask HN: Any resources to learn how to effectively use commenting?
The Minecraft clone in C thread a couple of days ago had a discussion about commenting and it got me thinking about the fact that I don't know how to effectively use comments while writing code (I'm mostly self-taught and don't work for a tech company, yet). Does anyone have any tips or know of good resources where one can learn this?
3 comments
[ 36.1 ms ] story [ 1072 ms ] thread@ noizyoyster.com
Basically: express yourself in code. If you feel that some part of your code needs commenting, ask instead if it's possible to rewrite the code so that it is self explanatory. (The book goes into much more detail about this and more, of course.)
Example of "bad" code:
Better code: