Click here to Skip to main content
14,766,907 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
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
mveCHill6018-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 
CalculateTax() may be a bad name - it may not be specific enough. It's not that far away from DoSomething(). OTOH, provided it's a private method, used in a context where its meaning is obvious, why would it still need comments, especially if its body reads like return amount * db.GetTaxRate()? Oh, you have GetTaxRate() in the same class, and it's accessing the database directly? That's a clear case poor encapsulation, where two classes, one coupled to the persistence layer and one strongly rooted in the business logic are shoved into a single one, and which need to be separated.

I too profoundly dislike comments. I think comments are a code stench (M. Fowler calls them smells, but I think "stench" is more descriptive). Every time I see comments in code I find that they are either useless (the code is quite understandable even without them) or are used to mask other problems (the code absolutely needs some refactoring).

Properly maintaining comments anywhere except in libraries which you develop for use across several projects, which you may plan to distribute without source code, is IMO waste, in terms of agile methods, and should therefore be eliminated.

Comments are also the source of many stupid problems. Since the compiler doesn't check comments, they tend to quickly become buggy, this being the case especially in heavily commented code. Having been bitten by this many times, I tend to disregard comments, and as such heavily commented code is annoying for me, since I have to skip large portions of prose to get to the parts which actually matter - and which I can actually trust.

Also, if you read a C++ header file or a Java or C# class file, and there's maybe 10 lines of comments between any two method or member declarations, you might get a very good understanding of the individual members, but loose the overall understanding of the class you're looking at. This increases the chances of introducing changes which break the overall architectural consistency, or even rightout introduce subtle conceptional bugs which are hard to diagnose.

Really, if your code needs commenting, take a better look at it, and think how you can refactor it into smaller, more specialized functions, with better names. Your code should become easier to read without comments if you do such refactorings. And there's a non-documentation-related gain too: you'll notice that code duplication goes down and your code becomes more compact.

In his book "The art of Unix programming" Eric S. Raymond states that he two most important attributes of user interfaces are discoverability (you can easily find out how to use the UI by playing with it) and transparency (you can easily build a correct mental model of the underlying application's workings by analyzing its user interface). IMO that's the case not just with user interfaces, it's the case with any product created by humans, including source code. If your code needs comments, it lacks at least one of those two properties. If something (really, anything) doesn't have any of those properties, people won't want to use it.
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
professional_Maxxx_24-Jan-13 3:10 
GeneralRe: Programming Question Pin
PIEBALDconsult16-Jan-13 18:09
professionalPIEBALDconsult16-Jan-13 18:09 
GeneralRe: Programming Question Pin
_Maxxx_16-Jan-13 18:20
professional_Maxxx_16-Jan-13 18:20 
GeneralRe: Programming Question Pin
PIEBALDconsult16-Jan-13 18:23
professionalPIEBALDconsult16-Jan-13 18:23 
GeneralRe: Programming Question Pin
TheGreatAndPowerfulOz17-Jan-13 6:12
MemberTheGreatAndPowerfulOz17-Jan-13 6:12 
JokeRe: Programming Question Pin
Harry Neethling17-Jan-13 20:52
professionalHarry Neethling17-Jan-13 20:52 
GeneralRe: Programming Question Pin
Chris Maunder16-Jan-13 18:44
cofounderChris Maunder16-Jan-13 18:44 
GeneralRe: Programming Question Pin
Brisingr Aerowing17-Jan-13 2:28
professionalBrisingr Aerowing17-Jan-13 2:28 
GeneralRe: Programming Question Pin
jharano18-Jan-13 5:49
Memberjharano18-Jan-13 5:49 
GeneralRe: Programming Question Pin
gggustafson18-Jan-13 4:58
professionalgggustafson18-Jan-13 4:58 
GeneralRe: Programming Question Pin
Chris Maunder18-Jan-13 5:24
cofounderChris 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
professionalgggustafson18-Jan-13 6:41 
GeneralRe: Programming Question Pin
Chris Maunder18-Jan-13 10:52
cofounderChris Maunder18-Jan-13 10:52 
GeneralRe: Programming Question Pin
gggustafson18-Jan-13 6:41
professionalgggustafson18-Jan-13 6:41 
GeneralRe: Programming Question Pin
Chris Maunder18-Jan-13 10:34
cofounderChris Maunder18-Jan-13 10:34 

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.