Click here to Skip to main content
11,431,307 members (70,059 online)

Welcome to the Lounge

   

For lazing about and discussing anything in a software developer's life that takes your fancy except programming questions.

Technical discussions are encouraged, but click here to ask your programming question.

The Lounge is rated PG. If you're about to post something you wouldn't want your kid sister to read then don't post it. No flame wars, no abusive conduct, no programming questions and please don't post ads.
 
GeneralRe: Programming Question Pin
PIEBALDconsult16-Jan-13 16:58
memberPIEBALDconsult16-Jan-13 16:58 
GeneralRe: Programming Question Pin
_Maxxx_16-Jan-13 17:03
member_Maxxx_16-Jan-13 17:03 
GeneralRe: Programming Question Pin
PIEBALDconsult16-Jan-13 18:11
memberPIEBALDconsult16-Jan-13 18:11 
GeneralRe: Programming Question Pin
Shameel16-Jan-13 19:37
memberShameel16-Jan-13 19:37 
GeneralRe: Programming Question Pin
kmoorevs17-Jan-13 12:28
memberkmoorevs17-Jan-13 12:28 
GeneralRe: Programming Question Pin
Earl Truss18-Jan-13 7:55
memberEarl Truss18-Jan-13 7:55 
GeneralRe: Programming Question Pin
_Josh_16-Jan-13 17:07
member_Josh_16-Jan-13 17:07 
GeneralRe: Programming Question Pin
AspDotNetDev16-Jan-13 17:34
protectorAspDotNetDev16-Jan-13 17:34 
GeneralRe: Programming Question Pin
_Maxxx_16-Jan-13 17:51
member_Maxxx_16-Jan-13 17:51 
GeneralRe: Programming Question Pin
AspDotNetDev16-Jan-13 18:03
protectorAspDotNetDev16-Jan-13 18:03 
GeneralRe: Programming Question Pin
_Maxxx_16-Jan-13 18:09
member_Maxxx_16-Jan-13 18:09 
GeneralRe: Programming Question Pin
Mark_Wallace16-Jan-13 22:00
memberMark_Wallace16-Jan-13 22:00 
GeneralRe: Programming Question Pin
Nagy Vilmos16-Jan-13 23:15
memberNagy Vilmos16-Jan-13 23:15 
GeneralRe: Programming Question Pin
M Towler17-Jan-13 23:18
memberM Towler17-Jan-13 23:18 
I am more of an adherent to the "comments are bad" brigade, so will offer a counter view. To be more precise I agree more with the statement that "all comments are apologies [for not making the code self documenting]". I do like statements of intent, not implementation.

In the example given, I like the function comment, it states the intent and required preconditions.

///
/// Calculate the tax, taking into account the fine passed.
/// Requires that the tax rate is retrievable from the TaxService
///

Whereas the following two appear to me to be worthless and merely clutter up the code. I can tell the first line is getting the tax rate, by the call to the self documenting function, and I know the rest is calculating the value because it is obviously a calculation and it corresponds with what the statement of intent in the function documentation was.

// Get the tax rate using the appropriate service
double taxRate = GetTaxRate();
// calculate the fine

Comments like the above make code harder to read IMO just due to volume of text. More importantly they are often not updated perfectly when code is maintained, especially when scripted edits are performed; I have been misled in the past by reading the comments and the two not corresponding and this has cost me time, so I would prefer to just read the code and not be distracted. Also where they are a repeat of the code they fail the DRY principle.

Like yourself I do write comments during the process of implementation, if I want to sketch out some pseudo code in a comment then slowly turn it into code (just in case I win the lottery and someone else has to finish it off). The difference for me is that once I have finished the code, the comments will have been almost entirely replaced by the code.
GeneralRe: Programming Question Pin
greldak17-Jan-13 23:32
membergreldak17-Jan-13 23:32 
GeneralRe: Programming Question Pin
M Towler18-Jan-13 1:27
memberM Towler18-Jan-13 1:27 
GeneralRe: Programming Question Pin
liordino18-Jan-13 2:29
memberliordino18-Jan-13 2:29 
GeneralRe: Programming Question Pin
patbob18-Jan-13 6:53
memberpatbob18-Jan-13 6:53 
GeneralRe: Programming Question Pin
JackDingler18-Jan-13 7:52
memberJackDingler18-Jan-13 7:52 
GeneralRe: Programming Question Pin
CHill6018-Jan-13 2:28
memberCHill6018-Jan-13 2:28 
GeneralRe: Programming Question Pin
John Atten18-Jan-13 3:32
memberJohn Atten18-Jan-13 3:32 
GeneralRe: Programming Question Pin
jrscherer18-Jan-13 5:08
memberjrscherer18-Jan-13 5:08 
GeneralRe: Programming Question Pin
jharano18-Jan-13 5:46
memberjharano18-Jan-13 5:46 
GeneralRe: Programming Question Pin
Florin Jurcovici18-Jan-13 20:06
memberFlorin Jurcovici18-Jan-13 20:06 
GeneralRe: Programming Question Pin
Klaus-Werner Konrad24-Jan-13 2:56
memberKlaus-Werner Konrad24-Jan-13 2:56 
GeneralRe: Programming Question Pin
_Maxxx_24-Jan-13 3:10
member_Maxxx_24-Jan-13 3:10 
GeneralRe: Programming Question Pin
PIEBALDconsult16-Jan-13 18:09
memberPIEBALDconsult16-Jan-13 18:09 
GeneralRe: Programming Question Pin
_Maxxx_16-Jan-13 18:20
member_Maxxx_16-Jan-13 18:20 
GeneralRe: Programming Question Pin
PIEBALDconsult16-Jan-13 18:23
memberPIEBALDconsult16-Jan-13 18:23 
GeneralRe: Programming Question Pin
ahmed zahmed17-Jan-13 6:12
memberahmed zahmed17-Jan-13 6:12 
JokeRe: Programming Question Pin
Harry Neethling17-Jan-13 20:52
memberHarry Neethling17-Jan-13 20:52 
GeneralRe: Programming Question Pin
Chris Maunder16-Jan-13 18:44
adminChris Maunder16-Jan-13 18:44 
GeneralRe: Programming Question Pin
Brisingr Aerowing17-Jan-13 2:28
memberBrisingr Aerowing17-Jan-13 2:28 
GeneralRe: Programming Question Pin
jharano18-Jan-13 5:49
memberjharano18-Jan-13 5:49 
GeneralRe: Programming Question [modified] Pin
gggustafson18-Jan-13 4:58
membergggustafson18-Jan-13 4:58 
GeneralRe: Programming Question Pin
Chris Maunder18-Jan-13 5:24
adminChris Maunder18-Jan-13 5:24 
GeneralRe: Programming Question Pin
jharano18-Jan-13 5:51
memberjharano18-Jan-13 5:51 
GeneralRe: Programming Question Pin
gggustafson18-Jan-13 6:41
membergggustafson18-Jan-13 6:41 
GeneralRe: Programming Question Pin
Chris Maunder18-Jan-13 10:52
adminChris Maunder18-Jan-13 10:52 
GeneralRe: Programming Question Pin
gggustafson18-Jan-13 6:41
membergggustafson18-Jan-13 6:41 
GeneralRe: Programming Question Pin
Chris Maunder18-Jan-13 10:34
adminChris Maunder18-Jan-13 10:34 
GeneralRe: Programming Question Pin
gggustafson18-Jan-13 12:45
membergggustafson18-Jan-13 12:45 
GeneralRe: Programming Question Pin
_Damian S_16-Jan-13 18:51
member_Damian S_16-Jan-13 18:51 
GeneralRe: Programming Question Pin
AspDotNetDev16-Jan-13 18:55
protectorAspDotNetDev16-Jan-13 18:55 
GeneralRe: Programming Question Pin
_Damian S_21-Jan-13 13:49
member_Damian S_21-Jan-13 13:49 
GeneralRe: Programming Question Pin
jschell17-Jan-13 9:50
memberjschell17-Jan-13 9:50 
GeneralRe: Programming Question Pin
Mark_Wallace16-Jan-13 21:28
memberMark_Wallace16-Jan-13 21:28 
GeneralRe: Programming Question Pin
harold aptroot16-Jan-13 22:41
memberharold aptroot16-Jan-13 22:41 
GeneralRe: Programming Question Pin
Pete O'Hanlon16-Jan-13 23:07
protectorPete O'Hanlon16-Jan-13 23:07 
GeneralRe: Programming Question Pin
_Maxxx_17-Jan-13 0:43
member_Maxxx_17-Jan-13 0:43 

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
Web03 | 2.8.150428.2 | Last Updated 4 May 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid