Why are comments important? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Why are comments important?

10th Jan 2017, 4:47 PM
dancor
dancor - avatar
5 ответов
+ 7
So that people know what you are trying to do in your parts of code.
10th Jan 2017, 4:49 PM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 4
To distract people from what you're *really* doing. Whoops, this is my dark hat. Um...what cheeze said.
10th Jan 2017, 5:57 PM
Kirk Schafer
Kirk Schafer - avatar
+ 2
Because code is read more often than it is written. Sure there is the argument that code should be self documenting but in practice I rarely see that. What I normally see is people either writing something that they can barely understand and then have to come back and figure out what the code was supposed to do (or even worse, someone else has to figure that out) or they wrote something and then don't touch it for a very long time. It's much easier to figure out the intent of code if you have the assistance of some will written documentation.
10th Jan 2017, 4:51 PM
James Durand
James Durand - avatar
+ 1
Even if you do not want to comment your code for others who could possibly use your code as extension at sometime. Document your code for yourself because it's true, like James said it. When you stopped watching your code for weeks and then you want to use it, you sometimes do not know anymore how your code works.
10th Jan 2017, 5:17 PM
Andreas K
Andreas K - avatar
0
It allows someone else to better understand your code. It is also helpful if you come back to a project after a while. Comments are a part of documentation. Makes things easier for both you and others.
12th Jan 2017, 1:57 AM
Aaron Sbarra