3 ms·
"...an excuse to comment rarely" Well you can also look at it from another angle: unnecessary comments are a distraction and make code less readable. You are
by thdrdt 6y ago
"...an excuse to comment rarely"
Well you can also look at it from another angle: unnecessary comments are a distraction and make code less readable.
You are not writing comments just to comment. You write them to make things clear.
Sometimes I also write comments to explain what, but most of the time those are written in large peaces of logic with multiple steps that cannot (or should not) split into multiple functions. But even then those comments tend to be in the form of 'why'.
For example: "// First we do this // Then we do this because.. // And as last step we do this because..."
My personal rule for comments:
If I come back in half a year, would I still understand what is going on here? No? -> Comment!