Click here to Skip to main content
13,149,099 members (56,464 online)

Welcome to the Lounge

   

For discussing anything related to a software developer's life. Technical discussions are encouraged, but click here to ask your programming questions.

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: Stupefying Bread Maker Pin
Walt Fair, Jr.17-Jan-13 0:16
subeditorWalt Fair, Jr.17-Jan-13 0:16 
GeneralRe: Stupefying Bread Maker Pin
Forogar17-Jan-13 5:38
memberForogar17-Jan-13 5:38 
GeneralRe: Stupefying Bread Maker Pin
Jonathan C Dickinson17-Jan-13 21:33
memberJonathan C Dickinson17-Jan-13 21:33 
GeneralRe: Stupefying Bread Maker Pin
AspDotNetDev18-Jan-13 7:35
protectorAspDotNetDev18-Jan-13 7:35 
GeneralProgramming Question Pin
_Maxxx_16-Jan-13 15:55
member_Maxxx_16-Jan-13 15:55 
GeneralRe: Programming Question Pin
PIEBALDconsult16-Jan-13 15:58
memberPIEBALDconsult16-Jan-13 15:58 
GeneralRe: Programming Question Pin
_Maxxx_16-Jan-13 16:03
member_Maxxx_16-Jan-13 16:03 
GeneralRe: Programming Question Pin
PIEBALDconsult16-Jan-13 17:11
memberPIEBALDconsult16-Jan-13 17:11 
GeneralRe: Programming Question Pin
Shameel16-Jan-13 18:37
memberShameel16-Jan-13 18:37 
GeneralRe: Programming Question Pin
kmoorevs17-Jan-13 11:28
memberkmoorevs17-Jan-13 11:28 
GeneralRe: Programming Question Pin
Earl Truss18-Jan-13 6:55
memberEarl Truss18-Jan-13 6:55 
GeneralRe: Programming Question Pin
_Josh_16-Jan-13 16:07
member_Josh_16-Jan-13 16:07 
GeneralRe: Programming Question Pin
AspDotNetDev16-Jan-13 16:34
protectorAspDotNetDev16-Jan-13 16:34 
GeneralRe: Programming Question Pin
_Maxxx_16-Jan-13 16:51
member_Maxxx_16-Jan-13 16:51 
I think comments are worth their weight so ling as they are written well - describing the business reasons not the technology (unless the tech is crafty, unusual or complex)

when I sit down to write a method, I start by calling it something

public double CalculateTax(double fine)
{
}


Then I comment it

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



Then I might write some test code just to get it building
///
/// Calculate the tax, taking into account the fine passed.
/// Requires that the tax rate is retrievable from the TaxService
///
public double CalculateTax(double fine)
{
    // TODO: Perform the tax calculation
    return 34567.89;
}


Then I start to flesh out the method by way of comments
///
/// Calculate the tax, taking into account the fine passed.
/// Requires that the tax rate is retrievable from the TaxService
///
public double CalculateTax(double fine)
{
    // Get the tax rate using the appropriate service
    // calculate the fine (I think it is just fine * tax rate but need to check with spec!)
}


Then, finally, I write the code
///
/// Calculate the tax, taking into account the fine passed.
/// Requires that the tax rate is retrievable from the TaxService
///
public double CalculateTax(double fine)
{
    // Get the tax rate using the appropriate service
    double taxRate = GetTaxRate();
    // calculate the fine 
    tax = taxRate * fine;
 
    return tax ;
}



That way, I can remember where I was if I get interrupted, the comments aren't an afterthought, they are a part of the process and, if I get hit by the Programmer bus, someone else should be able to see what I was doing.

Obv. the example is small and trivial, but that's how I work and I fail to understand the 'don't need comments' brigade.

What I do hate is/...

// Multiply the rate by the amount
return rate * amount;


which is simply a case of bad commenting in my book - it is not necessary to comment every step
MVVM# - See how I did MVVM my way
___________________________________________
Man, you're a god. - walterhevedeich 26/05/2011

.\\axxx
(That's an 'M')

GeneralRe: Programming Question Pin
AspDotNetDev16-Jan-13 17:03
protectorAspDotNetDev16-Jan-13 17:03 
GeneralRe: Programming Question Pin
_Maxxx_16-Jan-13 17:09
member_Maxxx_16-Jan-13 17:09 
GeneralRe: Programming Question Pin
Mark_Wallace16-Jan-13 21:00
memberMark_Wallace16-Jan-13 21:00 
GeneralRe: Programming Question Pin
Nagy Vilmos16-Jan-13 22:15
memberNagy Vilmos16-Jan-13 22:15 
GeneralRe: Programming Question Pin
M Towler17-Jan-13 22:18
memberM Towler17-Jan-13 22:18 
GeneralRe: Programming Question Pin
greldak17-Jan-13 22:32
membergreldak17-Jan-13 22:32 
GeneralRe: Programming Question Pin
M Towler18-Jan-13 0:27
memberM Towler18-Jan-13 0:27 
GeneralRe: Programming Question Pin
liordino18-Jan-13 1:29
memberliordino18-Jan-13 1:29 
GeneralRe: Programming Question Pin
patbob18-Jan-13 5:53
memberpatbob18-Jan-13 5:53 
GeneralRe: Programming Question Pin
JackDingler18-Jan-13 6:52
memberJackDingler18-Jan-13 6:52 
GeneralRe: Programming Question Pin
CHill6018-Jan-13 1:28
memberCHill6018-Jan-13 1:28 
GeneralRe: Programming Question Pin
John Atten18-Jan-13 2:32
memberJohn Atten18-Jan-13 2:32 
GeneralRe: Programming Question Pin
jrscherer18-Jan-13 4:08
memberjrscherer18-Jan-13 4:08 
GeneralRe: Programming Question Pin
jharano18-Jan-13 4:46
memberjharano18-Jan-13 4:46 
GeneralRe: Programming Question Pin
Florin Jurcovici18-Jan-13 19:06
memberFlorin Jurcovici18-Jan-13 19:06 
GeneralRe: Programming Question Pin
Klaus-Werner Konrad24-Jan-13 1:56
memberKlaus-Werner Konrad24-Jan-13 1:56 
GeneralRe: Programming Question Pin
_Maxxx_24-Jan-13 2:10
member_Maxxx_24-Jan-13 2:10 
GeneralRe: Programming Question Pin
PIEBALDconsult16-Jan-13 17:09
memberPIEBALDconsult16-Jan-13 17:09 
GeneralRe: Programming Question Pin
_Maxxx_16-Jan-13 17:20
member_Maxxx_16-Jan-13 17:20 
GeneralRe: Programming Question Pin
PIEBALDconsult16-Jan-13 17:23
memberPIEBALDconsult16-Jan-13 17:23 
GeneralRe: Programming Question Pin
ahmed zahmed17-Jan-13 5:12
memberahmed zahmed17-Jan-13 5:12 
JokeRe: Programming Question Pin
Harry Neethling17-Jan-13 19:52
memberHarry Neethling17-Jan-13 19:52 
GeneralRe: Programming Question Pin
Chris Maunder16-Jan-13 17:44
adminChris Maunder16-Jan-13 17:44 
GeneralRe: Programming Question Pin
Brisingr Aerowing17-Jan-13 1:28
memberBrisingr Aerowing17-Jan-13 1:28 
GeneralRe: Programming Question Pin
jharano18-Jan-13 4:49
memberjharano18-Jan-13 4:49 
GeneralRe: Programming Question Pin
gggustafson18-Jan-13 3:58
membergggustafson18-Jan-13 3:58 
GeneralRe: Programming Question Pin
Chris Maunder18-Jan-13 4:24
adminChris Maunder18-Jan-13 4:24 
GeneralRe: Programming Question Pin
jharano18-Jan-13 4:51
memberjharano18-Jan-13 4:51 
GeneralRe: Programming Question Pin
gggustafson18-Jan-13 5:41
membergggustafson18-Jan-13 5:41 
GeneralRe: Programming Question Pin
Chris Maunder18-Jan-13 9:52
adminChris Maunder18-Jan-13 9:52 
GeneralRe: Programming Question Pin
gggustafson18-Jan-13 5:41
membergggustafson18-Jan-13 5:41 
GeneralRe: Programming Question Pin
Chris Maunder18-Jan-13 9:34
adminChris Maunder18-Jan-13 9:34 
GeneralRe: Programming Question Pin
gggustafson18-Jan-13 11:45
membergggustafson18-Jan-13 11:45 
GeneralRe: Programming Question Pin
_Damian S_16-Jan-13 17:51
member_Damian S_16-Jan-13 17:51 
GeneralRe: Programming Question Pin
AspDotNetDev16-Jan-13 17:55
protectorAspDotNetDev16-Jan-13 17:55 
GeneralRe: Programming Question Pin
_Damian S_21-Jan-13 12:49
member_Damian S_21-Jan-13 12:49 

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.


Advertise | Privacy |
Web01 | 2.8.170924.2 | Last Updated 25 Sep 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid