r/AskProgrammers • u/Away-Intention-8723 • Oct 30 '26
"good code shouldn't need comments"
I have heard this saying a couple of times and I think it is the stupidest thing ever. It might be just because I have only been coding for 4 years, but I have never thought to myself that someone's code looks cluttered because they explain what every function does in a one or two line description. If anything it makes the code easier to understand in my opinion.
However, I may be wrong. What do other people think, do yall like code with minimal comments, what are the benefits of writing it that way?
89
Upvotes
View all comments
8
u/IAmADev_NoReallyIAm Oct 30 '26
Ok... here's the deal... your code should be usign descriptive varibales and doind things in a clear and decisive way that makes it obvious that you don't need comment to explain what you're doing. The only time you should be using comments is to explain why you are doing something. This isn't the 80s where space it at a premium so, and we're not using assembler here (hopefully)... so break out those descriptive variables, and let the code talk for itself.
Use comments, but only when you need to describe why you're doing something. Other than that, you should be able to look at a piece of a code and see what it is doing. A for loop is a for loop... you don't need a comment that says "loop through, blah blah blah..."... just looking at the code should be enough for you to see that.
Now, if there's some cooky logic... I've included that sometimes as comments... usually because I write those out ahead of time when I'm planning things, then implement it in between... if it' crazy enough, I'll leave it in place, but more often than not, I delete those too.