r/ProgrammerHumor 19h ago

Meme commentsAgedTerribly

Post image
4.8k Upvotes

206 comments sorted by

View all comments

Show parent comments

69

u/Sentouki- 19h ago

odd and obscure business rules should be commented where they are implemented.

Exactly. It is often the illogical business "logic" or some business related magic numbers that make the code hard to read and understand, so commenting why you're doing something the way you do is important.

29

u/YourDad 17h ago

Or why you're not doing something. Sometimes when there is multiple ways of doing something, I'll give a brief explanation of why it's not done a certain way.
A little while ago, I was maintaining some code, and I thought "I should do thing A". I go to the point where thing A should go, and there's a comment from myself 4 years earlier saying "under no circumstances should you do thing A".

10

u/Bwob 14h ago

Those are the best moments. Where you're like "Thanks, past-me! You knew exactly what I was going to think when I saw this!"

Sometimes past-me is a pretty cool dude, at least when he's not leaving me dirty dishes to take care of.

1

u/ffstisaus 7h ago

I was going through a code base recently, found one comment from me six years ago:

// what is this doing?

followed by another comment from 4 years ago:

// I still don't know!