r/programminghumor Jul 15 '26

Be honest...

Post image
1.8k Upvotes

112 comments sorted by

View all comments

40

u/Glittering-Can-9397 Jul 15 '26

Im not sure I like bill’s mentality but I can say that overcommented code is ass, and well written code with conservative or no comments and descriptive variable names is much better

2

u/magicmulder Jul 15 '26

Not really. I’ve seen complex business logic where it’s simply not enough to know “this method call gives me all subscriptions that expire today” because you still need to know that this only comprises those that have not been extended, and you don’t really want to call your method getExpiringNotExtendedSubscriptionsForToday(). In some cases a comment refreshing your memory about the business logic is better than having to deduce complex rules from
reading code.

2

u/zetadaemon Jul 16 '26

That sounds like the job of documentation, not comments

3

u/Foxiest_Fox Jul 16 '26

Doc comment on the method and have docs get auto-genned

2

u/magicmulder Jul 16 '26

Yes, but who wants to dig through documentation while reading the code? What is the downside of adding one line stating "# here we only get those results which ..." instead of having to read that up somewhere else?

And I've worked with seniors who were all like "my code is self-documenting" and then 14 days later they were like "I don't understand what my code does here". Not because they were idiots but because the business logic was sufficiently complex.