Do you think it´s needed to comment code, unless is an API?
I mean, a good code. With self explanatory variables and methods.
Theres the need to comment a good code?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s a good question, but also very subjective. If you write very solid code and have a well-designed application, almost every part of it will be self-explanatory (self-documenting). But, ask yourself if that’s really the case before you dismiss comments.
That said, good comments often clarify the greater intent of pieces of code, packages, classes; they give a higher-level overview of what you’re doing instead of “explaining” just a few lines. And ofcourse, it’s useful to comment hard to understand pieces of code (complicated algorithms).
Anyway, you don’t have to litter your code with comments if it’s just for private use and the scope of your project is limited, just place comments intuitively when you think there’s the need for clarification. You’ll often be glad you did when you go back to a piece of code later and have to modify it.