Hacker News new | ask | show | jobs
by shawabawa3 2492 days ago

        // If the x position is less than 0
        if(xPosition < 0)
Looks like they have some kind of policy of at least 10% of code lines must be comments or something
1 comments

I write such comments sometimes, the reason is simple: when a codebase has a lot of comments in general comments often act as separators of "groups of code" (and often read like short prose), so seeing a bit of code not having them feels unbalanced and i add some generic comment. The comment acts more as a separator or header, in a "this is the part where we do XYZ", than anything else.

Also this has to be taken into account with syntax highlighting where comments are made to stand out. It doesn't work that much when comments use a faded out color (like some schemes use) or without syntax highlighting at all (well, except perhaps if you use ====== ALL CAPS COMMENTS ====== :-P).

But even then, "Set negative x values to 0" would be a more informative header than repetition of just one part of the statement