3 ms·
Agreed. Comments that explain in English exactly what the next line does drive me crazy. Even if the line is complicated. I pretty much only ever comment thi
by jesse__ 4y ago
Agreed. Comments that explain in English exactly what the next line does drive me crazy. Even if the line is complicated. I pretty much only ever comment things these days when I change from one approach to another. ie.
// This code is weird. I tried doing it the obvious way, but that doesn't work because .. reasons ..
Sometimes, if the code is short, I'll even leave the old/obvious code there for future reference when I look at the weird code and say to myself:
"This is weird! Obviously it should work in this much simpler way.."
- blowski 4y agoI mostly use comments to explain business rules, and why are they implemented there. # High value orders need to be approved before refund # Similar logic is also applied elsewhere, this is here # as a failsafe. if ticketValue > 500: emailCustomerSupport(ticket) else refund
- omnicognate 4y agoI know you by ".. reasons .." you mean "<and I add the reasons here>", but I've seen too many comments worded exactly like that. Some programmers use comments (correctly) to explain reasoning and context, some use them to redundantly say what the code already says and some, apparently, use them to apologise.