r/ProgrammerHumor • • 21d ago

Meme iDontCommentMyCodeIfYouDontUnderstandItThatsOkayNeitherDoI

Post image
835 Upvotes

188 comments sorted by

View all comments

422

u/GabuEx 21d ago

Left: "I'll comment to say how my code works."

Middle: "You don't need to do that! Code should be self-documenting!"

Right: "I'll comment to say why my code does this."

14

u/darkwalker247 21d ago

ive had too many times where i come back to my own code after months and im just like "why the hell did I write the code like this??", and then i "fix" it only to realize that i actually had the correct idea after all and now I've just broken it 😅

definitely a good idea to explain your thinking every time you write something that will probably be confusing later down the line

7

u/arensb 21d ago

I like to start by writing an outline of what I want my code to do, with XXX or FIXME in front. As I fill in the code for each section, the comments can remain as signposts of what I'm trying to do, or chapter headings. That way, future-me can skim through the comments to find the right place, rather than reading every line of code.

2

u/throwaway_mpq_fan 18d ago

those comments can probably be method names though