4 ms·
I think the favourite type of comment I've ever left in my code follows this template: DEAR MAINTAINER: This code is the way it is because of <reasons
by anotherevan 2y ago
I think the favourite type of comment I've ever left in my code follows this template:
DEAR MAINTAINER:
This code is the way it is because of <reasons go here>.
Once you are done trying to 'fix' this, and have realised what a terrible
mistake that was, please increment the counter as a warning to the next
person:
total_hours_wasted_here = n
I'm not the original author, but have gratefully used it once or twice, and been amused when there was a single line commit incrementing the counter.
- tombert 2y agoI wish I had had this years ago. I one time wrote this fairly elaborate SQL generation thing that required pretty liberal use of recursion in order to fulfill all the requirements. It ended up being a lot of mutual recursion and the code was admittedly kind of messy but it was a necessary evil to do everything asked of me. A more senior engineer ended up taking over the codebase, "fixed" all my code to be this iterative thing, made a point to try and lecture me about why recursion is bad in an email, only for his code to not actually do everything required and him reinventing effectively everything I did with recursion. In fairness, he did actually apologize to me for some of the comments he made, but if I had thought about putting this comment on the top maybe we could have avoided the whole thing.
- bccdee 2y agoI've never heard anyone say recursion is bad. What a weird view. It's a problem if you're overflowing the stack, of course, but otherwise…