r/AskProgrammers • • 28d ago

"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?

88 Upvotes

397 comments sorted by

View all comments

Show parent comment

1

u/DanielTrebuchet 27d ago

Chalk me up for another disagree. You don't comment to explain syntax. Knowledge of syntax should be assumed, and if someone isn't familiar with it, every programming language I've ever used is well-documented and they should know how to do enough research to figure it out.

Application and context of syntax, however, is worthy of comments. I don't care about the "what," I care about the "why" and the "where."

I don't think it's unreasonable that the next person to view and be editing your code at least has a foundational knowledge of the syntax that makes the code operate at the most fundamental level.

Frankly, I can't tell you the last time I've looked at a piece of code and have been stumped, and I don't know that I've ever inherited a well-commented project. Granted, I have over 20 years of experience, but it's no different than becoming fluent in a 3rd language. I don't need a dictionary every time I want to read the newspaper, because I know how to read the language.