DEV Community

Discussion on: My take on commenting code - Explain why, not how

Collapse
 
simeg profile image
Simon Egersand 🎈

I've heard reasoning for both sides (comment a lot vs. never). I agree with you though. I try my best to avoid comments but sometimes it's warranted.

My decision making is something like "will myself or someone else be confused by this code (that I can't, for some reason, make cleaner) in a month? Better add a comment".

As I've gotten more experienced with programming, the less comments I write. But the more docs (Java docs for example) I write.

Thanks for sharing! Good stuff.

Collapse
 
nombrekeff profile image
Keff

Thanks for reading!! I agree with you as well, there's times that it's difficult to make clean/understandable code with the time we have to work on it. So adding a comment can be a good solution!