3 ms·
> Unless you are writing completely brilliant code your future self will hate you if you skimp on comments. The vast majority of comments I usually see can be
by seanwilson 9y ago
> Unless you are writing completely brilliant code your future self will hate you if you skimp on comments.
The vast majority of comments I usually see can be rolled into variable names or function names. If you're writing lots of comments, that's a good indication your code is hard to understand, your variables are badly named and your functions are too long in my opinion. I think people that say "your code is bad if you don't have any comments" have things backwards personally.
Pretty much the only time I use comments is when I'm forced to write weird code to workaround an API bug, to explain an unintuitive optimisation or to give high-level architecture documentation.
I've honestly returned to code I've written myself maybe 5 years later and rarely had an issue that would have been helped with more comments.