Click here to Skip to main content
15,314,455 members

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.15
I add comment headers for all non-public classes, objects and methods, as well as non-obvious logic inside these24630.00
I provide comments at the top of files17821.71
I comment any code that may be obscure (the "what") to a reader51162.32
I comment any code where the purpose (the "why") may be obscure54466.34
I comment on expected inputs, outputs and other results17621.46
I comment on exceptions, side effects or error codes20525.00
I comment on structures (loop endings, function endings etc)10713.05
I comment as a last resort when I can't make my code any clearer22227.07
I do not comment code.465.61
Respondents were allowed to choose more than one answer; totals may not add up to 100%

View optional text answers (45 answers)


 
GeneralRe: No comment(s) Pin
savire21-Jul-10 22:45
Membersavire21-Jul-10 22:45 
GeneralRe: No comment(s) Pin
hfrmobile26-Jul-10 23:02
Memberhfrmobile26-Jul-10 23:02 
GeneralHow vs What Pin
Eksith20-Jul-10 0:37
MemberEksith20-Jul-10 0:37 
GeneralRe: How vs What Pin
Theraot20-Jul-10 23:39
MemberTheraot20-Jul-10 23:39 
GeneralThis poll and maby more other polls Pin
RomTibi19-Jul-10 23:00
MemberRomTibi19-Jul-10 23:00 
GeneralComment Everything Pin
Deus ex Machina19-Jul-10 11:56
MemberDeus ex Machina19-Jul-10 11:56 
GeneralRe: Comment Everything Pin
RedSonja19-Jul-10 21:15
MemberRedSonja19-Jul-10 21:15 
GeneralRe: Comment Everything Pin
Roland7121-Jul-10 15:31
MemberRoland7121-Jul-10 15:31 
when it comes to commenting i also comment everything. especially global or scoped variables whose purpose may look obscure. Nothing to do with age, or anything. just something that was drilled into me in college.

commenting your code is king. specially if another programmer looks at the code they can easily tell what function/method/ect .. does what, and if the comments are done right, they should provide a quick overview of the last couple of revisions to that chunk of code.

This information is invaluable to programmers looking at someone else's code for the first time.
GeneralA college TA.... Pin
El Corazon19-Jul-10 6:48
MemberEl Corazon19-Jul-10 6:48 
GeneralRe: A college TA.... Pin
Ennis Ray Lynch, Jr.19-Jul-10 7:08
MemberEnnis Ray Lynch, Jr.19-Jul-10 7:08 
GeneralRe: A college TA.... Pin
CDMTJX20-Jul-10 3:07
MemberCDMTJX20-Jul-10 3:07 
GeneralRe: A college TA.... Pin
RugbyLeague20-Jul-10 4:35
MemberRugbyLeague20-Jul-10 4:35 
GeneralRe: A college TA.... Pin
savire21-Jul-10 22:48
Membersavire21-Jul-10 22:48 
GeneralOne more comment on the matter Pin
Ennis Ray Lynch, Jr.19-Jul-10 6:35
MemberEnnis Ray Lynch, Jr.19-Jul-10 6:35 
JokeRe: One more comment on the matter Pin
The Man from U.N.C.L.E.19-Jul-10 10:14
MemberThe Man from U.N.C.L.E.19-Jul-10 10:14 
GeneralRe: One more comment on the matter Pin
Muammar©19-Jul-10 19:39
Member Muammar©19-Jul-10 19:39 
GeneralRe: One more comment on the matter Pin
Stephen F. Heffner19-Jul-10 12:05
MemberStephen F. Heffner19-Jul-10 12:05 
GeneralI wish Pin
Ennis Ray Lynch, Jr.19-Jul-10 6:31
MemberEnnis Ray Lynch, Jr.19-Jul-10 6:31 
GeneralRe: I wish Pin
El Corazon19-Jul-10 6:37
MemberEl Corazon19-Jul-10 6:37 
GeneralRe: I wish Pin
peterchen19-Jul-10 8:18
Memberpeterchen19-Jul-10 8:18 
GeneralRe: I wish Pin
El Corazon19-Jul-10 8:19
MemberEl Corazon19-Jul-10 8:19 
GeneralRe: I wish Pin
peterchen19-Jul-10 8:54
Memberpeterchen19-Jul-10 8:54 
GeneralRe: I wish Pin
Stephen F. Heffner19-Jul-10 12:09
MemberStephen F. Heffner19-Jul-10 12:09 
GeneralRe: I wish Pin
destynova20-Jul-10 22:40
Memberdestynova20-Jul-10 22:40 
GeneralComments are just a way to use SVN as a communication protocol. Pin
elchupathingy19-Jul-10 4:43
Memberelchupathingy19-Jul-10 4:43 

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.