+ 14

Why we use comments in programming?

Is it mandatory to use comments?

19th Apr 2019, 10:30 AM
Mr AJX 😎😈
Mr AJX 😎😈 - avatar
29 odpowiedzi
+ 14
Using Comments in our code is very helpful for the users reading our code... Although it is not compulsory but yet you should insert comments like <!--Table section started --> Or //Table section started It also helps the coder writing the code in knowing where the table section started and where ended ... /* Note : As many Comments in your code may make your code look bad ... */
19th Apr 2019, 6:14 PM
Shourya
Shourya - avatar
+ 12
Of course, short comment like "getting names from an array" is nice, but something like "looping an array with class members names and use it to..." is too long.
19th Apr 2019, 5:11 PM
Barteker
Barteker - avatar
+ 11
If you provide your program then comments help them to read your program..
19th Apr 2019, 11:11 AM
Bilal Ahmed
Bilal Ahmed - avatar
+ 11
On the other hand if the methods are short their names tell us a lot.
19th Apr 2019, 5:19 PM
Barteker
Barteker - avatar
+ 10
In my opinion code should be readable without comments. So use them when the situation requires it.
19th Apr 2019, 4:54 PM
Barteker
Barteker - avatar
+ 9
The usefulness of comments usually occurs to us a few months in. When we look again at codes we wrote ourselves a few weeks ago. And suddenly have trouble understanding how they even work.
19th Apr 2019, 11:01 AM
HonFu
HonFu - avatar
+ 8
They are like notes to readers of the code including the writer.
20th Apr 2019, 1:54 PM
Sonic
Sonic - avatar
+ 7
For youself and for future programmers, who maintain your code
19th Apr 2019, 10:22 PM
UraL
+ 6
Comments are not necessary. They are used to make code more readable.
19th Apr 2019, 10:43 AM
Mukul
Mukul - avatar
+ 6
Bilal Ahmed thank you help me
19th Apr 2019, 2:01 PM
Mr AJX 😎😈
Mr AJX 😎😈 - avatar
+ 6
HonFu thanks
19th Apr 2019, 2:03 PM
Mr AJX 😎😈
Mr AJX 😎😈 - avatar
+ 5
Thank you so much Alexander Sheremet
19th Apr 2019, 3:42 PM
Mr AJX 😎😈
Mr AJX 😎😈 - avatar
+ 5
Barteker thanks
19th Apr 2019, 6:18 PM
Mr AJX 😎😈
Mr AJX 😎😈 - avatar
+ 5
UraL thanks
20th Apr 2019, 4:18 AM
Mr AJX 😎😈
Mr AJX 😎😈 - avatar
+ 5
Sonic thanks
21st Apr 2019, 4:18 AM
Mr AJX 😎😈
Mr AJX 😎😈 - avatar
+ 4
Thank you Mukul
19th Apr 2019, 2:00 PM
Mr AJX 😎😈
Mr AJX 😎😈 - avatar
+ 4
Barteker, but a one-line comment over a 'paragraph' of code, say over ten coherent lines of code that do one thing, can still make a code more readable, even if it's well written.
19th Apr 2019, 4:59 PM
HonFu
HonFu - avatar
+ 4
Luis Ch. Thanks
19th Apr 2019, 6:17 PM
Mr AJX 😎😈
Mr AJX 😎😈 - avatar
+ 4
If you working with team or if you working on something very long or difficult ,"comments help you renumber "
26th Apr 2019, 1:44 AM
Omar Khalil Bakhsh
Omar Khalil Bakhsh - avatar
+ 3
Mr. Anonymous Thank you so much 😃
19th Apr 2019, 6:16 PM
Mr AJX 😎😈
Mr AJX 😎😈 - avatar