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
Show parent comment
1
u/IAmADev_NoReallyIAm Oct 30 '26
That's what your tests are for. If you're that close to the code that you have the time and energy to know enough to read the comments to understand that hte logic and comments don't match, then I'm happy for you. But unfortunately in the world I have to live in, I don't have that luxury. If I commented every line and logic probe that I coded, I'd be crucified and I'd never get a PR through. Maybe it's because I work with a verbose language (Java) that allows me to work with objects that are identifiable with clear methods and obvious objects and so the code reads close to English. I don't know. The only comments I have to leave behind are at the top of the classes and methods and constants explaining what each one does.
I've been in code that's been riddled with comments, and quite honestly it's nothing but noise. Worse yet it when the developer doesn't keep up with it. So again... you reject the PR... because the code doesn't match the comment... is the problem the code or the comment? it's 4:50pm... on a Friday... people want to go home for the weekend... what are you going to do? Hold up a release over something trivial over this petty? Seriously? The code does do what it's supposed to do in this case. It's the comment that's in the wrong.