The Mudcat Café TM
Thread #28443   Message #352856
Posted By: Jon Freeman
06-Dec-00 - 11:58 PM
Thread Name: BS: Is this comprehensible?
Subject: RE: BS: Is this comprehensible?
Yep Sarah, but where do you draw the line. I can not imagine any programmer failing to understand that code without comments and still fail to see the need to document 6 lines of code.

I guess I could have written:

  begin
for Employee := 1 to 5 do {step through each employee}
begin
Write('Enter hours worked: ');{prompt for hours worked}
Read(Hours){accept user input for hours worked};
if Hours > 20 then{compare hours worked to 20 and take appropriate action}
Pay := Hours * 4.00{calculate pay if more than 20 hours are worked}
else
Pay := Hours * 3.75;{calculate pay if 20 or fewer hours are worked}
WriteLn('Pay due = ', Pay:5:2){output pay due};
end;{repeat process for next employee until 5 are covered}
end.
What I am trying to ask here is whether THIS program waranted comments rather than whether comments can be useful within programming. I still fail to see that any programmer, even one unfamiliar with pascal but familiar with C or Java would need comments as an aid to understanding the program (and I believe over use is a pain in the ass) and that whether, as appears to have been indicated that users would be interested in such things.

As regards pain in the ass documentation, this assignment was documented with flow chart, trace diagram and data table.

Jon