Click here to Skip to main content
11,718,016 members (78,644 online)

Survey Results

Do you comment your code?   [Edit]

Survey period: 19 Jul 2010 to 26 Jul 2010

Some preach that good code requires no comments, while others preach that (good) comments can be as valuable as the code itself. On which part of the spectrum do you lie?

OptionVotes% 
I add comment headers for all public classes, objects and methods, events, fields etc36244.15362 votes, 44.15%
I add comment headers for all non-public classes, objects and methods, as well as non-obvious logic inside these24630.00246 votes, 30.00%
I provide comments at the top of files17821.71178 votes, 21.71%
I comment any code that may be obscure (the "what") to a reader51162.32511 votes, 62.32%
I comment any code where the purpose (the "why") may be obscure54466.34544 votes, 66.34%
I comment on expected inputs, outputs and other results17621.46176 votes, 21.46%
I comment on exceptions, side effects or error codes20525.00205 votes, 25.00%
I comment on structures (loop endings, function endings etc)10713.05107 votes, 13.05%
I comment as a last resort when I can't make my code any clearer22227.07222 votes, 27.07%
I do not comment code.465.6146 votes, 5.61%
Respondents were allowed to choose more than one answer; totals may not add up to 100%

(No text answers)


 
GeneralOut of date comments Pin
jmw24-Jul-10 17:59
memberjmw24-Jul-10 17:59 
GeneralRe: Out of date comments Pin
Kevin McFarlane25-Jul-10 5:17
memberKevin McFarlane25-Jul-10 5:17 
GeneralAll are great about comments Pin
makhaai24-Jul-10 1:37
membermakhaai24-Jul-10 1:37 
GeneralComments are.. Pin
Steppenwolfe23-Jul-10 2:00
memberSteppenwolfe23-Jul-10 2:00 
GeneralRe: Comments are.. Pin
LOKImotive5-May-14 12:45
memberLOKImotive5-May-14 12:45 
GeneralFormatting and Variable Naming Pin
DonDriskell22-Jul-10 9:24
memberDonDriskell22-Jul-10 9:24 
GeneralDepending on the language comments may not be required Pin
kjmcsd22-Jul-10 8:08
memberkjmcsd22-Jul-10 8:08 
GeneralRe: Depending on the language comments may not be required Pin
peterchen23-Jul-10 4:02
memberpeterchen23-Jul-10 4:02 
GeneralRe: Depending on the language comments may not be required Pin
tec-goblin23-Jul-10 10:56
membertec-goblin23-Jul-10 10:56 
GeneralRe: Depending on the language comments may not be required Pin
peterchen23-Jul-10 11:23
memberpeterchen23-Jul-10 11:23 
GeneralRe: Depending on the language comments may not be required Pin
tec-goblin24-Jul-10 2:53
membertec-goblin24-Jul-10 2:53 
GeneralRe: Depending on the language comments may not be required Pin
tec-goblin23-Jul-10 10:57
membertec-goblin23-Jul-10 10:57 
GeneralRe: Depending on the language comments may not be required Pin
LOKImotive5-May-14 12:53
memberLOKImotive5-May-14 12:53 
JokeReal Programmers don't comment their code... Pin
Kevin Drzycimski22-Jul-10 0:08
memberKevin Drzycimski22-Jul-10 0:08 
GeneralRe: Real Programmers don't comment their code... Pin
LOKImotive5-May-14 12:57
memberLOKImotive5-May-14 12:57 
GeneralTrusting someone else sound sense Pin
gstolarov21-Jul-10 15:36
membergstolarov21-Jul-10 15:36 
GeneralRe: Trusting doc ... no, but ... Pin
GoodTime Charlie, VA22-Jul-10 7:29
memberGoodTime Charlie, VA22-Jul-10 7:29 
GeneralRe: Trusting doc ... no, but ... Pin
gstolarov22-Jul-10 8:27
membergstolarov22-Jul-10 8:27 
GeneralI comment any code where the purpose (the "why") may be obscure Pin
koolprasad200320-Jul-10 23:16
memberkoolprasad200320-Jul-10 23:16 
GeneralRe: I comment any code where the purpose (the "why") may be obscure Pin
Tomz_KV21-Jul-10 3:58
memberTomz_KV21-Jul-10 3:58 
GeneralRe: I comment any code where the purpose (the "why") may be obscure Pin
Xiangyang Liu 刘向阳21-Jul-10 15:08
memberXiangyang Liu 刘向阳21-Jul-10 15:08 
GeneralRe: I comment any code where the purpose (the "why") may be obscure Pin
Tomz_KV22-Jul-10 1:26
memberTomz_KV22-Jul-10 1:26 
GeneralA comment on commments Pin
Mike Hankey20-Jul-10 3:33
memberMike Hankey20-Jul-10 3:33 
GeneralRe: A comment on commments Pin
Tak21-Jul-10 3:51
memberTak21-Jul-10 3:51 
GeneralRe: A comment on commments Pin
Mike Hankey21-Jul-10 5:06
memberMike Hankey21-Jul-10 5:06 

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

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


Advertise | Privacy | Mobile
Web04 | 2.8.150901.1 | Last Updated 10 Aug 2007
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid