Click here to Skip to main content
16,016,901 members

Survey Results

What do you comment in your code?   [Edit]

Survey period: 28 May 2007 to 3 Jun 2007

Conventional wisdom says comments are good. How far do you go in the pursuit of explanation?

Q1. I comment...

OptionVotes% 
All namespaces21926.61
All classes, structs and interfaces60573.51
All public methods67181.53
All protected methods47958.20
All private methods43452.73
All events and delegates40348.97
All class member variable declarations28234.26
All constant declarations29135.36
All enumerations33240.34
All local variable declarations14817.98
All control structures such as loops and case statements29936.33
Respondents were allowed to choose more than one answer; totals may not add up to 100%



 
GeneralWho is fooling whom here! Pin
leonm546-Jun-07 14:23
leonm546-Jun-07 14:23 
GeneralMaintaining Both Code and the associated Comments Pin
c-sharp2-Jun-07 8:49
c-sharp2-Jun-07 8:49 
QuestionOOPS Concepts Pin
Sathyan...30-May-07 19:10
Sathyan...30-May-07 19:10 
AnswerRe: OOPS Concepts Pin
WillemM30-May-07 23:56
WillemM30-May-07 23:56 
GeneralGhostDoc! Pin
Uwe Keim30-May-07 9:53
sitebuilderUwe Keim30-May-07 9:53 
GeneralReal Programmers Pin
Jim Crafton30-May-07 6:44
Jim Crafton30-May-07 6:44 
GeneralRe: Real Programmers Pin
Andrew Torrance30-May-07 6:57
Andrew Torrance30-May-07 6:57 
GeneralRe: Real Programmers Pin
Garth J Lancaster31-May-07 21:01
professionalGarth J Lancaster31-May-07 21:01 
GeneralWhile We're At It Pin
W Balboos, GHB29-May-07 7:18
W Balboos, GHB29-May-07 7:18 
GeneralRe: While We're At It Pin
Jeffrey Walton1-Jun-07 21:32
Jeffrey Walton1-Jun-07 21:32 
GeneralThe myth of self documenting code [modified] Pin
Duncan Edwards Jones29-May-07 3:05
professionalDuncan Edwards Jones29-May-07 3:05 
GeneralRe: The myth of self documenting code Pin
Gary Wheeler29-May-07 4:36
Gary Wheeler29-May-07 4:36 
GeneralRe: The myth of self documenting code Pin
El Corazon29-May-07 4:56
El Corazon29-May-07 4:56 
GeneralRe: The myth of self documenting code Pin
iactv29-May-07 8:39
iactv29-May-07 8:39 
... and there are many instances where comments are even useful to a *programmer*.

I'm a fairly proficient developer in a number of different languages. But if I'm in a given mindspace in order to work in a particular language, and I have to interface with services in other languages, I could easily (and often) misinterpret what the external code is doing, especially at crunchtime when I can least afford to waste time.

Afterall, even something as simple as the equalsign means markedly different things in different languages.
if (x = y)
in VB means something completely different than it does in most other languages. And while you could argue that such a line would technically be poorly written if it were in anything other than VB, the end result is that if I was trying to decipher it while I was in the mindset of programming in VB, I would completely misinterpret the purpose of the entire function containing that line and would not receive the result from the service I was expecting.

Whereas a simple comment stating "compares x and y, and returns splat if equal" - 2 minutes of time spent max - would potentially save hours of troubleshooting for other consumers.
GeneralRe: The myth of self documenting code Pin
Kevin McFarlane30-May-07 4:45
Kevin McFarlane30-May-07 4:45 
GeneralDan Saks said it best Pin
Gary Wheeler29-May-07 1:15
Gary Wheeler29-May-07 1:15 
GeneralRe: Dan Saks said it best Pin
KarstenK29-May-07 3:05
mveKarstenK29-May-07 3:05 
GeneralRe: Dan Saks said it best Pin
chaiguy133730-May-07 4:21
chaiguy133730-May-07 4:21 
GeneralRe: Dan Saks said it best Pin
KarstenK30-May-07 4:42
mveKarstenK30-May-07 4:42 
GeneralRe: Dan Saks said it best Pin
Paul Glaubitz31-May-07 2:46
Paul Glaubitz31-May-07 2:46 
JokeRe: Dan Saks said it best Pin
Xiangyang Liu 刘向阳1-Jun-07 4:24
Xiangyang Liu 刘向阳1-Jun-07 4:24 
GeneralRe: Dan Saks said it best Pin
Xiangyang Liu 刘向阳1-Jun-07 4:19
Xiangyang Liu 刘向阳1-Jun-07 4:19 
GeneralRe: Dan Saks said it best Pin
leonm546-Jun-07 14:36
leonm546-Jun-07 14:36 
GeneralComment to the comment poll Pin
KarstenK28-May-07 21:53
mveKarstenK28-May-07 21:53 
GeneralAll? Pin
Marc Clifton28-May-07 17:00
mvaMarc Clifton28-May-07 17:00 

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.