Click here to Skip to main content
15,922,696 members

Survey Results

What's more important - easily understandable code or good comments?   [Edit]

Survey period: 1 Sep 2003 to 7 Sep 2003

You would hope to get both, but given a choice, which would you take?

OptionVotes% 
Easily understandable code69066.60
Good comments34633.40



 
GeneralEasy understandable code really exists? Pin
Masaaki Onishi6-Sep-03 17:34
Masaaki Onishi6-Sep-03 17:34 
GeneralComments? Pin
Tim Smith6-Sep-03 7:14
Tim Smith6-Sep-03 7:14 
GeneralRe: Comments? Pin
Bugs Bunny6-Sep-03 10:20
Bugs Bunny6-Sep-03 10:20 
GeneralComment should be useful Pin
Anonymous5-Sep-03 20:53
Anonymous5-Sep-03 20:53 
GeneralRe: Comment should be useful Pin
Jörgen Sigvardsson5-Sep-03 21:30
Jörgen Sigvardsson5-Sep-03 21:30 
GeneralFunction headers Pin
praiseGod7775-Sep-03 7:14
praiseGod7775-Sep-03 7:14 
GeneralEasy code for the compiler Pin
Dirk Vandenheuvel5-Sep-03 2:23
Dirk Vandenheuvel5-Sep-03 2:23 
GeneralRe: Easy code for the compiler Pin
Anonymous5-Sep-03 8:26
Anonymous5-Sep-03 8:26 
GeneralRe: Easy code for the compiler Pin
Renault the Duck5-Sep-03 17:20
Renault the Duck5-Sep-03 17:20 
I disagree - the business rule is plain for any reader - fire anybody over 58... I wish half the code I worked with were this easy to follow.

If I'm asked to 'fix' it, I assume someone will tell me what the problem is - "We want to start firing people at 45" or "It's not legal to do this." Given a statement of the problem, and the code above, it's pretty easy to fix.

Even in this example:

<br />
if (employee.Age() > 58 &&<br />
    employee.getSuperSecretValue() < 7 &&<br />
    employee.getToastPreferences() != prefWellDone)<br />


What could a comment add?
// Fire employees whose super secret value is lt 7 <br />
//because the HR-assigned value must be over 7 for employees<br />
// that are 59+.  Mary from HR likes her toast well done.<br />


Do these reasons have a bearing on the actual business rule, which is apparent from the code itself?

Personally, my pet peeve is this:
<br />
// initializate the application<br />
app.initialize();<br />
// open the file<br />
file.open();<br />
<br />
// defect #1234 - Jeremiah Bullfrog<br />
file.print();<br />


Those fine example of commentary are by far the most common I see. Completely useless... but people seem to think that they serve a purpose.


- Renault
GeneralRe: Easy code for the compiler Pin
Anonymous8-Sep-03 7:53
Anonymous8-Sep-03 7:53 
GeneralRe: Easy code for the compiler Pin
Oleksandr Kucherenko5-Sep-03 22:04
Oleksandr Kucherenko5-Sep-03 22:04 
GeneralWhat would you prefer? A straight road or a maze and a map? Pin
G. Raven4-Sep-03 5:49
G. Raven4-Sep-03 5:49 
GeneralRe: What would you prefer? A straight road or a maze and a map? Pin
Paul Oss4-Sep-03 11:54
Paul Oss4-Sep-03 11:54 
GeneralComments, Margins, and Readability Pin
Marc Clifton4-Sep-03 3:08
mvaMarc Clifton4-Sep-03 3:08 
GeneralRe: Comments, Margins, and Readability Pin
Michael P Butler4-Sep-03 5:23
Michael P Butler4-Sep-03 5:23 
GeneralRe: Comments, Margins, and Readability Pin
Marc Clifton4-Sep-03 5:27
mvaMarc Clifton4-Sep-03 5:27 
GeneralRe: Comments, Margins, and Readability Pin
Michael P Butler4-Sep-03 5:49
Michael P Butler4-Sep-03 5:49 
GeneralRe: Comments, Margins, and Readability Pin
Gary R. Wheeler4-Sep-03 7:01
Gary R. Wheeler4-Sep-03 7:01 
GeneralRe: Comments, Margins, and Readability Pin
Anonymous4-Sep-03 10:57
Anonymous4-Sep-03 10:57 
GeneralRe: Comments, Margins, and Readability Pin
cK14-Sep-03 19:00
cK14-Sep-03 19:00 
GeneralRe: Comments, Margins, and Readability Pin
Stephen Quattlebaum5-Sep-03 7:20
Stephen Quattlebaum5-Sep-03 7:20 
GeneralRe: Comments, Margins, and Readability Pin
Jörgen Sigvardsson5-Sep-03 21:30
Jörgen Sigvardsson5-Sep-03 21:30 
GeneralRe: Comments, Margins, and Readability Pin
Festus Redelinghuys7-Sep-03 13:47
Festus Redelinghuys7-Sep-03 13:47 
GeneralRe: Comments, Margins, and Readability Pin
Chris Maunder4-Sep-03 8:19
cofounderChris Maunder4-Sep-03 8:19 
GeneralRe: Comments, Margins, and Readability Pin
Marc Clifton4-Sep-03 8:24
mvaMarc Clifton4-Sep-03 8:24 

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.