Re:Maybe comments should explain 'what' (2017)
by coffeebeqn on Sunday January 04, 2026 @07:04AM
(#46487188)
I also do that but I’d argue that business rules/quirks count as a “why”
[ Parent
| on HN ]
Re:Maybe comments should explain 'what' (2017)
by mashally on Sunday January 04, 2026 @08:01AM
(#46487526)
I agree with that as well, the "why" explains the business logic and that makes much more sense to me. Otherwise, I might end up explaining the algorithm (the "what") instead of the business behind it.
Re:Maybe comments should explain 'what' (2017)
by gbin on Sunday January 04, 2026 @07:20AM
(#46487279)
I agree it is about "what the code is technically doing" vs why which is "what external factor you need to understand to read this"
Re:Maybe comments should explain 'what' (2017)
by troupo on Sunday January 04, 2026 @07:12AM
(#46487234)
They are often a "why" in the form of "what the hell" :)
Re:Maybe comments should explain 'what' (2017)
by bostik on Sunday January 04, 2026 @08:51AM
(#46487940)
While I agree, I think that's still incomplete. To me good comments have always been about "what is being done AND why".
Or to put it another way: to provide the necessary context for figuring out why a particular piece of code is written the way it's done. (Or what it's supposed to do.)