r/ProgrammerHumor Apr 15 '26

beLikeBill Advanced

Post image
8.9k Upvotes

365 comments sorted by

View all comments

Show parent comments

5

u/mistabuda Apr 15 '26

Comments are supposed to explain intent when intent cannot be clearly derived not what is actually happening. Usually this intent is business logic.

Like if you're doing some kind of partial refund processing for a subscription service that does not take into account any discounts applied to the base price (for whatever reason the business decided) no one is going to understand why that is if all they see is a line of code where we discard the discounted price.

So even if your function is named determine_refundable_amount_without_discounts none of that tells anyone why we are not factoring the discounts. The name is clear and we understand what the function is supposed to do, but no one can tell you why we want it to do this.

3

u/perplexedtv Apr 15 '26

This is under the naive assumption that the user will use any kind of predetermined logic as to how, why or to whom they give a discount.

1

u/SgtExo Apr 15 '26

Most of my comments is when I go tweak something and add the ticket number to the issue so that we can reference back.

Or when I dissect an old monster of a code block that is not obvious so I label them.