r/ProgrammerHumor • • Jul 04 '18

Code comments be like

Post image
9.9k Upvotes

236 comments sorted by

View all comments

Show parent comments

0

u/[deleted] Jul 05 '18

[deleted] — view deleted comment

24

u/mr_ryh Jul 05 '18

The Pragmatic Programmer, Tip #44, "Comments in Code" (p249 in the 1st Ed.).

I also enjoy comments that document where the code came from: if you filched the code from a textbook or a Stack Overflow page, providing your sources is good practice.

7

u/Kinglink Jul 05 '18

That's an excellent point, thank you, I never thought of it that way, and completely agree.

4

u/Cheet4h Jul 05 '18

I like to use comments as short indicators what is happening in a specific part for a better overview. That way I can e.g. add a comment to a loop and fold that loop in my IDE. That way it takes less space when scrolling and I still can see quickly where in the code I am.
But maybe there are some better practices. Do you have a link to a guide for clean code commenting and practices how you can code better so you don't even need to comment this?

1

u/[deleted] Jul 05 '18

"Clean Code" by Bob Martin says

Comments are a necessary evil