Re:Ask HN: What do you consider as “bad” code?
by usrbinbash on Tuesday January 25, 2022 @11:22AM
(#30073685)
> Why comment a code that's mapped to problem trivially observably
"trivially observable" is not a defined measurement however. What a piece of my code does may be perfectly obvious to me, but mystifying to someone else, or even to myself in 4 months. I am not advocating for half a page of comments before each top level definition, or trivial comments like `// this requests data from server` , but a single line of comments above each function or typedef isn't too much to ask.
> If some bug is encountered with new code, you can comment-out new code and uncomment-out old code quickly
I can also check out the commit where it was last changed, stash the info, and apply it to my dev branch. Same functionality, and less cruft in the code.
"trivially observable" is not a defined measurement however. What a piece of my code does may be perfectly obvious to me, but mystifying to someone else, or even to myself in 4 months. I am not advocating for half a page of comments before each top level definition, or trivial comments like `// this requests data from server` , but a single line of comments above each function or typedef isn't too much to ask.
> If some bug is encountered with new code, you can comment-out new code and uncomment-out old code quickly
I can also check out the commit where it was last changed, stash the info, and apply it to my dev branch. Same functionality, and less cruft in the code.