I just don't agree with number 12 as I believe self-documented code is better code.
I think comments are really useful in very specific cases, where your code can't explain what you want to achieve. About the author and date, the VCS covers that part of the comment.
In number 16 I would just add a default case to every switch case for enums, it is a good practice and helps developers when they add a new value to the enum.
Thanks @pedroduarten9
for pointing it out. I agree with you on both points.
However, on number 12 it is advised for Java beginners to add comments on class/method which helps in Javadoc, not on the code to explain. As you say - comments are really useful in very specific cases. I'll update the article to mitigate this confusion.
Cheers!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Great article and guidelines.
I just don't agree with number 12 as I believe self-documented code is better code.
I think comments are really useful in very specific cases, where your code can't explain what you want to achieve. About the author and date, the VCS covers that part of the comment.
In number 16 I would just add a default case to every switch case for enums, it is a good practice and helps developers when they add a new value to the enum.
Keep going!
Thanks @pedroduarten9 for pointing it out. I agree with you on both points.
However, on number 12 it is advised for Java beginners to add comments on class/method which helps in Javadoc, not on the code to explain. As you say - comments are really useful in very specific cases. I'll update the article to mitigate this confusion.
Cheers!