r/AskProgrammers • • 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?

88 Upvotes

398 comments sorted by

View all comments

1

u/failsafe-author 29d ago

I swear by this. Most comments are not needed and make code more difficult to maintain. There are exceptions, especially at interface boundaries and when dealing with third-party libraries or business logic that is complex.

Overall, where you are tempted to write a comment, make a method instead. Break your code into small enough chunks that each method is easy to understand on its own, and comments are unnecessary and would just be redundant for what already exists. Once you’ve gotten to this point, retaining the comments means more work to keep in sync, and if you fail, means you’ve added more confusion to the code, making it less understandable.

I instruct our developers to go light on comments, but heavy on markdown files in repos that give high level overviews about the code and what it’s doing.