I hate the "code should be self-explanatory so no comments" thing. I love comments. However, *how many* comments also depends on the language - in Elixir I write less because I feel it's expressive. I would write a ton of comments in C or a new language.
-
Show this thread
-
Replying to @whatyouhide
I once got told to remove my comments in a code review back when I worked with JavaScript, the reason: the code should be self-explanatory. A part of me died that day.
1 reply 0 retweets 3 likes -
Replying to @gausby @whatyouhide
IMO try not to comment the ‘what’ unless the code is hard to understand (maybe work more on it, m extract something out). But do comment the ‘why’. Ex this annoys me a little: // adds one to i i+=2
1 reply 0 retweets 1 like -
Replying to @TheoAndersen @whatyouhide
I think blatantly obvious comments annoy everybody—especially when they are wrong. I like to comment algorithms…because I want to be able to read it three months later; and also edge cases get a comment because they might seem weird at a first glance.
1 reply 0 retweets 1 like
this is a good summary. Obvious is bad in most cases. Commenting the why of code, algorithms, domain knowledge, edge cases, "hacks", is fundamental to write understandable and maintenable software in my opinion.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.