loading...

re: We Don't Need No Steenking Comments VIEW POST

FULL DISCUSSION
 

I would say anything up to 50% would be acceptable. Obviously 50% would be uncommon, but I would think there are a few circumstances where it is appropriate.

I think it also depends on your coding style. I often sketch out what I want to achieve in comments first, and then fill in the blanks. This then leaves a record of what was intended, which can be very helpful when revisiting something once a bug is discovered as it quickly triages the bug into either "the code doesn't do what it should" or "we didn't think of this case when writing the code". But it does mean you can end up with some long comments. Doubt I've ever hit 50% though, but I've probably hit 30%.

I would be interested to know what percentage were comments vs blank lines though, as I was surprised you lumped them together in your count. They seem like quite distinct groups of "lines of code that can be removed".

 

For me it's mostly "I'm likely to need to cold-revisit this 6-18 months later: leave myself a trail of breadcrumbs to search for".

Even the nearly 29% "not code" of the particular tool isn't purely commentary: at least a third of that was "readability" null-lines. I lumped them together because I was more interested in "how much of this is actual code" vice "how much of this is 'helper' content" (searchable-comments or 'readability' blank-lines).

code of conduct - report abuse