Click here to Skip to main content
15,897,519 members

Survey Results

To whom do you direct comments in your code?

Survey period: 31 Jul 2016 to 7 Aug 2016

Do you write comments to those you work with? To yourself? To a different version of yourself (mandatory XKCD)

OptionVotes% 
To those who would need to maintain the code86965.04
To those looking to use my code49837.28
To those working on the code with me44633.38
To my managers / team lead745.54
To the poor souls who have to review my code27920.88
To my future self1,02076.35
To my future robot overloads977.26
To future palaeontologists987.34
Other312.32
I don't write comments in code896.66
Respondents were allowed to choose more than one answer; totals may not add up to 100%



 
GeneralRe: Nope Pin
PeejayAdams31-Jul-16 22:46
PeejayAdams31-Jul-16 22:46 
GeneralRe: Nope Pin
Sander Rossel1-Aug-16 1:43
professionalSander Rossel1-Aug-16 1:43 
GeneralRe: Nope Pin
PeejayAdams1-Aug-16 6:02
PeejayAdams1-Aug-16 6:02 
GeneralRe: Nope Pin
Sander Rossel1-Aug-16 21:40
professionalSander Rossel1-Aug-16 21:40 
GeneralRe: Nope Pin
PeejayAdams2-Aug-16 0:08
PeejayAdams2-Aug-16 0:08 
GeneralRe: Nope Pin
Brad Stiles2-Aug-16 2:01
Brad Stiles2-Aug-16 2:01 
GeneralRe: Nope Pin
Chris Maunder1-Aug-16 9:49
cofounderChris Maunder1-Aug-16 9:49 
GeneralRe: Nope Pin
Sander Rossel1-Aug-16 21:38
professionalSander Rossel1-Aug-16 21:38 
Chris Maunder wrote:
I present my rebuttal as to why comments are necessary[^].
You do make a good point. What's obvious to me now may not be obvious to others now and/or later or myself later. When you comment everything at least it will be clear to everyone always.

Except that commenting isn't easy and many programmers aren't very good at it.
A lot of comments I've read are just the name of a function, but properly spaced and capitalized. Or really state the obvious, like "assign the variable" (really, I've seen multiple programmers do it... why would anyone comment that? Unsure | :~ ).
And comments are just lines of code that need to be updated, something you can't test for and which is easily, and often, forgotten.
In all the projects I've worked on so far I've learned to ignore comments because never ever ever have they actually helped me. Only when I'm really stuck and I see a comment somewhere do I read it, only to be disappointed once again.
A lot of comments I read aren't even true, they're downright lies and, if anything, confuse rather than help!
Worst case scenario, a comment makes good sense (a rare case indeed), but the code doesn't do what the comment says it does, now who's right?

I can remember a few times where I have commented code.
One was a timer that should trigger at 11:00, but triggered a few milliseconds early. Upon completion I got the next time at which it should run which was... 11:00! And it immediately triggered again. After days of debugging (where the problem never occurred) I found out the milliseconds were the problem. Fix and comment.

Another was with Crystal Reports where getting a property on an object caused the whole object to drop its state (the connection string was reset etc.) rendering it useless... Unsure | :~
That's some of the weirdest sh*t I've seen, so that's when I wrote a comment.

Other than that I mostly remember deleting comments like "assign the variable", "Save the customer" (above the line customer.Save();), "Save the customer" (above the line product.Save();), "Helper variable" (above the line string helper;), etc... Sigh | :sigh:

So if I have to pick between 95% useless comments that annoy me to no end and 5% comments that may be helpful someday or no comments at all I'd go for no comments at all. I'm pretty sure I can figure out that weird piece of code if ever the need be Smile | :)
You DO make a good point though and I can understand why you'd work that way.
Read my (free) ebook Object-Oriented Programming in C# Succinctly.
Visit my blog at Sander's bits - Writing the code you need.
Or read my articles here on CodeProject.
Simplicity is prerequisite for reliability.
— Edsger W. Dijkstra
Regards,
Sander

GeneralRe: Nope Pin
Mycroft Holmes3-Aug-16 17:20
professionalMycroft Holmes3-Aug-16 17:20 
GeneralI especially comment things like (for other dev and myself): Pin
R. Erasmus31-Jul-16 21:02
R. Erasmus31-Jul-16 21:02 
GeneralI don't write comments in code Pin
Beginner Luck31-Jul-16 19:43
professionalBeginner Luck31-Jul-16 19:43 
GeneralRe: I don't write comments in code Pin
Agent__00731-Jul-16 21:01
professionalAgent__00731-Jul-16 21:01 
GeneralRe: I don't write comments in code Pin
Beginner Luck31-Jul-16 21:05
professionalBeginner Luck31-Jul-16 21:05 
GeneralRe: I don't write comments in code Pin
Efe Erdoğru1-Aug-16 11:42
professionalEfe Erdoğru1-Aug-16 11:42 
GeneralRe: I don't write comments in code Pin
Beginner Luck1-Aug-16 12:38
professionalBeginner Luck1-Aug-16 12:38 
GeneralRe: I don't write comments in code Pin
dan!sh 2-Aug-16 18:04
professional dan!sh 2-Aug-16 18:04 
Generalto my future self... Pin
Jim Meadors31-Jul-16 19:05
Jim Meadors31-Jul-16 19:05 
GeneralRe: to my future self... Pin
kalberts1-Aug-16 23:12
kalberts1-Aug-16 23:12 
GeneralFor My future use and for those who maintain code Pin
koolprasad200331-Jul-16 18:12
professionalkoolprasad200331-Jul-16 18:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.