+ 8

The compiler ignores everything that appears in the comment, so why should i use them?

20th Jun 2016, 12:47 PM
Nastaran Noruzi
Nastaran Noruzi - avatar
41 Respostas
+ 28
it's for documentation, when you're working on the same program you may forget what some part of the code does, so you should comment it. And if aren't working alone you should comment so your teamates understand what you did
20th Jun 2016, 2:28 PM
Cezar Azevedo
Cezar Azevedo - avatar
+ 11
Cezar got it right. Still, there are some dos and don'ts of how to make *good* comments: * make them short and descriptive * don't state the obvious * don't renarrate the code Anyone want to add a point?
20th Jun 2016, 2:39 PM
Stefan
Stefan - avatar
+ 11
you see...on professional level...one project is collection of millions of source files...and they are made by thousands of workers...so lets say if you write a 100 line code to calculate some formula...and some other guy needs to understand it FAST so you add comments...instead of reading the whole code...a 1 line comment can specify the porpouse of the whole code...
25th Jun 2016, 3:00 PM
Mukul Kumar
Mukul Kumar - avatar
+ 2
so helpul,tnq,im not very professional but im in the way ;)
20th Jun 2016, 3:02 PM
Nastaran Noruzi
Nastaran Noruzi - avatar
+ 2
jst to make our program more user friendly and informative
16th Dec 2016, 7:36 PM
nikhil vasaikar
nikhil vasaikar - avatar
+ 2
Comments are used to help another human to understand what the code does. That can be important if multiple people work on a single project together.
16th Dec 2016, 10:18 PM
JustSomeRandomStuff
JustSomeRandomStuff - avatar
+ 2
since you are developing a program writing comments will help you and also the person who executes it other than you can easily. understand the programming and the logic which you used....
17th Dec 2016, 10:06 AM
Mohd Sabahat
Mohd Sabahat - avatar
+ 2
Sometimes it's better to clarify what we are doing and where. Because once we go on with bigger programs we can't distinguish things. So, prevention is better than again debugging and revising. Providing Comments also helps to outsiders(who has not programmed) to grasp the code.
17th Dec 2016, 9:44 PM
Aditi Thakur
Aditi Thakur - avatar
+ 2
You definitely understand how much comments will help you when you're going to develop a advanced programme
18th Dec 2016, 6:07 AM
Isura Gayan
Isura Gayan - avatar
+ 2
To understand what code u wrote when the program is finished. It is also very helpful when working in team for a project. It is a good habit to write COMMENTS
18th Dec 2016, 3:57 PM
Saksham
Saksham - avatar
+ 1
totally agree, Stefan :)
20th Jun 2016, 2:57 PM
Sardor
Sardor - avatar
+ 1
Maybe you want to add something, Sardor? :-)
20th Jun 2016, 3:00 PM
Stefan
Stefan - avatar
+ 1
Nastaran, maybe you are interested in rephrasing your question a little? It might be a bit hard to understand for other beginners what you actually wanted to know. I say this in good faith, I'm trying to improve the "learning material" in the forum. Maybe it's worth it :-)
20th Jun 2016, 3:20 PM
Stefan
Stefan - avatar
+ 1
ur right mr stephan,but im not very good at engish,by the way i try to improve mysefl next time ;)
20th Jun 2016, 3:26 PM
Nastaran Noruzi
Nastaran Noruzi - avatar
+ 1
check it again,better now or just waste the time?! :)))
20th Jun 2016, 3:32 PM
Nastaran Noruzi
Nastaran Noruzi - avatar
+ 1
Thank you Nastaran, this has been a positive experience through and through. :-)
20th Jun 2016, 3:35 PM
Stefan
Stefan - avatar
+ 1
Try to find in your memory the most complicated algorithm or program you ever made. Was it hard to do? I believe it was. After a few weeks you probably forgot the details. Using comments let you know how it works without making it again, step by step in your head whenever you look at your code. Remember that your future projects will be more and more complicated. Also if you would like to show it to someone else it is easier for him to read the comments than to analyse all the code.
16th Dec 2016, 9:54 AM
Adam Emieljaniuk
Adam Emieljaniuk - avatar
+ 1
because it help to understand the code you writen to someone who read your code
16th Dec 2016, 11:46 AM
Abhishek Dubey
Abhishek Dubey - avatar
+ 1
for some the sudo code turns into the commets/documentation
16th Dec 2016, 3:45 PM
Paul Sherwood
Paul Sherwood - avatar
+ 1
صبر داشته باش دختر، در ادامه کسب تجربه برنامه نویسی بهش نیاز پیدا می کنی!
16th Dec 2016, 9:26 PM
Farhad Shafaq
Farhad Shafaq - avatar