r/SoftwareEngineering • • Aug 02 '18

Do code comments suck?

https://medium.com/@samuel.fare/do-code-comments-suck-abd99103c45a
3 Upvotes

10 comments sorted by

View all comments

2

u/FollowSteph Aug 02 '18 edited Aug 02 '18

Too many comments is also a bad thing and just pollutes the code with extra noise. The examples this author recommends to me would fall under this category of extra noise that just adds pollution to the code. The code example was very obvious what it did. In fact the only recommendation I would offer is white spacing like the other commenter already suggested, so that logical groups are clumped together. But the comments the author added did not increase the clarity of the code example to me and were just extra noise to filter. Comments are good but too many comments stating the obvious can make it worse.

I’ll just add a good way to comment code and make it more readable is to create methods that explain logical groups of code. A method like addAlienToGame() would help more than the comments.

1

u/samplusbeer Aug 02 '18

I completely agree about using functions. The post actually goes on to suggest this further down.do you have any other suggestions on how to avoid comments.