[COFF] Code/comment Ratios Style

Warren Toomey via COFF coff at tuhs.org
Mon Jul 21 07:26:07 AEST 2025


I've written my fair share of code and also taught several languages. I'd
estimate my comment to total LOC ratio as about 1/4 to 1/3. But I keep
coming across code bases where the ratio is closer to 1/100 and it really
bugs me! I just can't read the codebase and work out the nuances of what
it is doing.

So this isn't a rant so much as a request for alternate perspectives. If
you have a spartan commenting style, why? Can you read your code and see
all the implications, or do you dislike lots of comments, or do you write
more external documentation etc.?

When I taught, I had two mantras about comments:

 Code explains how, comments explain why.

 Code as if the person who takes over your codebase
 is a crazed psychopath who knows where you live.

Thanks!
	Warren


More information about the COFF mailing list