Why Do You Comment Your Code?Survey on commenting
19 Replies - 2388 Views - Last Post: 24 September 2008 - 03:26 PM
#1
Why Do You Comment Your Code?
Posted 01 May 2008 - 12:24 PM
I am a research professor at the New Mexico Institute of Technology and am conducting a study that deals with program comprehension. If you have time, I'm looking for professonal programmers to take a survey located at
http://www.senseandu...rvey/survey.php
Thank you for your help.
Replies To: Why Do You Comment Your Code?
#2
Re: Why Do You Comment Your Code?
Posted 01 May 2008 - 12:28 PM
Would you be so kind as to share your findings/results?
My brother and a good family friend goes to New Mexico Tech so anything I can do to support the program, let me know!
#3
Re: Why Do You Comment Your Code?
Posted 01 May 2008 - 12:54 PM
I've heard one of my coworkers talk a tiny bit about this, seems interesting and would like to see where it can go.
Interesting thing I do is, although I am the primary consumer of my own comments, I write them for others, because that makes more sense when I come back 2 years later and have forgotten most of the context surrounding it.
#4
Re: Why Do You Comment Your Code?
Posted 01 May 2008 - 01:00 PM
#5
Re: Why Do You Comment Your Code?
Posted 01 May 2008 - 07:33 PM
I was wondering if you might clarify who you would like to participate. I missed the word "professonal" the first time I read your post.
I code in my free time when and/or when I'm bored and I do it for the organization where I volunteer(mostly simple web interfaces).
I wouldn't really consider myself a professional though.
You might consider making that slightly clearer on the survey page itself.
Per
#6
Re: Why Do You Comment Your Code?
Posted 01 May 2008 - 10:02 PM
#7
Re: Why Do You Comment Your Code?
Posted 01 May 2008 - 11:41 PM
I completed your survey, I'd be interested to see the results.
#8
Re: Why Do You Comment Your Code?
Posted 02 May 2008 - 06:41 AM
I comment my code so I can use it later.
especialy when I do somthing that is particularly different.
I never know if my brain will be thinking on the same line or not.
a problem that takes me about an hour to figure out at one time might take
me a day at another.
#9
Re: Why Do You Comment Your Code?
Posted 02 May 2008 - 07:41 AM
Code is human readable documentation. It is the documentation for producing something that is computer readable. Anyone who understands the language of that documenation should be able to read it. Comments are like footnotes for when the document itself needs something to strengthen it's point.
Some comments on the survey:
Question 7, "How important is it that other people understand your code?" doesn't undestand maintainability. After a few years, the programmer is "other people".
Question 9, real answer, comments are useful for maintaining code.
Question 12, "what is most important when trying to understand a new program?". Context need. Does this mean a program that the programmer has never seen before or one that's about to be written? I assumed the former. Real answer, a fundamental understanding of programming methodologies. Language isn't most important and "similar problem" is too vague.
Question 14, "How much information should be contained in a useful comment?", the options are, "As little as possible", "As much as needed". These are the same answer.
Question 15, for importance, options are "Code that works" and "Code that is easy to understand". Code that works is a given, if it doesn't work, it's not really a program. Code that is easy to understand is probably well factored, which is ideal. There may be an implicit assumption in this one that comments make code easier to understand? This is not the case. Well written code without comments breaking up the flow is easier for programmers to understand.
Question 16, "most efficient code possible" is to subjective to illicit a valid response. You can make very "efficient code" that is only marginally maintainable. You can make code that's well written, not the most efficient, or the quickest to write, but most maintainable. Heavily optimized code will always be "most efficient code possible" and a maintenance nightmare.
#10
Re: Why Do You Comment Your Code?
Posted 02 May 2008 - 07:44 AM
Comments are great, especially if you are looking at someone else's code and trying to put everything together.
#11
Re: Why Do You Comment Your Code?
Posted 02 May 2008 - 12:39 PM
Let me explain the "professional" statement: I mean people who are not currently students (especially undergraduate students). Most studies of program comprehension were conducted on students because the researchers were often--like me--academics and they had a ready supply of participants for their studies in the form of their students. However, these findings are hard to generalize to real programmers--that is to say, people who are working in any capacity to code in the "real" world--because the realities of the workplace are much much different than the realities of college.
I'd also like to say thanks for the great points made above about the survey questions. I don't really want to comment on them until after the study has concluded, as I don't want to alter anyone's initial responses. However, if you've taken the survey and would like to discuss the questions I'd be happy to do so offline, just send me a note.
Thanks again
#12
Re: Why Do You Comment Your Code?
Posted 02 May 2008 - 12:50 PM
I just wanted to recommend that you put some kind of clarification on the survey page itself because I'm sure there will be people who miss the word "professional" in your original post and don't necessarily scroll down and read these posts until after they have completed it.
Per
#13
Re: Why Do You Comment Your Code?
Posted 13 May 2008 - 02:07 PM
Quote
#14
Re: Why Do You Comment Your Code?
Posted 16 September 2008 - 01:29 PM
I posted this survey quite awhile ago here and a couple of other forums, and quite honestly all but two responses have come from the posters here: thank you.
However I've only received 52 survey responses as of right now--three+ months later. I need at least over a hundred to have anything substantial (quantitatively speaking).
Could you please forward the address to coworkers and friends? http:www.senseandusability.com/survey/survey.php
I've placed what I currenlty have in a database and will run analysis/breakdown on it soon, but am hoping to get the numbers up before I report back as to the results.
Thanks again,
nmprof
#15
Re: Why Do You Comment Your Code?
Posted 16 September 2008 - 01:54 PM
|
|

New Topic/Question
Reply



MultiQuote










|