3 ms·
We need to be very clear that the specific thing the author is objecting to is mandatory javadoc - the adding of comments which are just copies of the function
by pjc50 8y ago
We need to be very clear that the specific thing the author is objecting to is mandatory javadoc - the adding of comments which are just copies of the function name in English and convey no non-obvious information. These are definitely unnecessary for those reading the code. They should only be put in if there are consumers of the API who can only read the javadoc and function signatures, not the code.
(On my Visual Studio theme, comments are green on a dark grey background. What's the significance? Probably none.)
- tlrobinson 8y agoIf JavaDoc comments are necessary for documentation but unnecessary for reading / editing the code, then perhaps the editor should deemphasize JavaDoc comments and emphasize normal comments. I think the same should be true of type annotations. They are important to the compiler and as documentation, but should be deemphasized relative to the actual logic.
- joshtynjala 8y agoI found it surprising that the author didn't mention the possibility of deemphasizing doc comments at the same time that they increase the emphasis of regular comments. Doc comments have value for consumers of libraries, so I'm not always able to remove them, like the author did. However, doc comments have a slightly different syntax, so we can make regular comments prominent, like the author suggests, and we can make doc comments less prominent so they aren't distracting.
- Thiez 8y agoI find that adding the mandatory comments everywhere ensures that you won't forget to add that extra line of information when it does make sense. It's a good habit, like looking over your shoulder before switching lanes even when you know there's nobody there.