do you comment your code ?

Necuno

Court Jester
Joined
Sep 27, 2005
Messages
58,566
Reaction score
3,437
not even sure why I’m asking this, but going through some code that’s so illogical, weird and uncommented. I’m just wondering maybe if this person had like just wrote logical functions with some comments if it might have been better. the thought of just rewriting comes to mind :rolleyes:

I guess that we are all bad in the beginning, some just stay there professionally.
 
I normally don't put many comments in Code, I normally try to write self documenting code.i.e. Names of variables, functions etc. should state the purpose it has. Only in cases where there is a complex piece of code do put in comments or when the function of a piece of code is not immediately clear.
 
I normally don't put many comments in Code, I normally try to write self documenting code.i.e. Names of variables, functions etc. should state the purpose it has. Only in cases where there is a complex piece of code do put in comments or when the function of a piece of code is not immediately clear.

what i prefer, self documenting code, but where it is out of the norm add a comment.
 
I try to comment it as completely as possible. It just makes using classes / properties / functions that much easier and logical, especially when combined with Intellisense...
 
In our environment, it is highly likely that someone else might find himself digging around in my code trying to alter it for a different application or improvement.

It is highly annoying when there is no intro (saying what the stuff in the file does, who wrote it, when etc) or comments about what the *blip* is going on in any portion of the code. Comment your stuff! My opinion. :-)

I read this funny comment in a piece of source one day that illustrates why:

"When I wrote this, only I and God knew what was going on here. Now, only God knows."

:D
 
I always try and add documentation code to classes, functions, etc, but inside a function I don't really add comments because I have explained ontop op the method/functions what is going to happen. If the code really gets trickey and I or some else might not know what is going on sometime down the line, I will add a comment.
 
I found a comment in a piece of code where a Exception is being thrown that I was getting: "This can't happen"

lol :D

Discovery health's Software had one error that said something like "Catastrophic Failure" :p
 
I try to comment it as completely as possible. It just makes using classes / properties / functions that much easier and logical, especially when combined with Intellisense..

+1 Yes XML comments in .NET are a must! Apart from those I also mainly go along the self documenting route...
 
not even sure why I’m asking this, but going through some code that’s so illogical, weird and uncommented. I’m just wondering maybe if this person had like just wrote logical functions with some comments if it might have been better. the thought of just rewriting comes to mind :rolleyes:

I guess that we are all bad in the beginning, some just stay there professionally.
i do
nt ever put comments
 
// start of post

Guess it depends on your enviroment. Not all code can be written self documented, but no all code should be documented either.

// next paragraph comes here.

If your working on a project that is going to have many new developers after you, then document not only your code but write readmes on the technology your using. But if your writing so basic for-loops and the next guy to work on it is the same level (or better) than you, then screw it, level the comments out.

// end of post
// you should see no more text after this line.
 
I comment and use descriptive variables where possible. I also indent properly
 
I fiddle a lot with other people's code, comments help me keep track of my changes. Also helps when fixing mistakes, sorry I mean bugs.
 
// end of post
// you should see no more text after this line.
__________________
Ubuntu 8.10 Acer Aspire One
Ubuntu 9.04 Work / Home Desktop
Real friends don't let friends use Windows
Neotel since 2008-09-23

/*
* It's comments like these that spawn treads like this...
*/
 
Top
Sign up to the MyBroadband newsletter
X