Hello All
In a thread a week or so ago, someone suggested that they were going to start a thread about the use of comments. As no one has so far taken this task in hand here are a few things to discuss.
Are comments a good thing or a bad thing, in that they become an excuse for not writing proper support documentation?
Does code written with clearly named variables(ie self describing code) need comments?
Is overcommented code as bad as poorly commented code?
At what size would a sub/function not need comments?
There are loads more things to be said about comments but hopefully these will start the ball rolling.
This has become a subject dear to my heart in the last few weeks. I have taken over a number of sizable VB projects which came with no commented code and minimal, if any, docs.
Some parts of the code have obviously been taken from the internet and MSDN and the only changes made to the code has been the removal of comment, go figure.
Personnally, I have always used comments at the start of a sub/function to describe it as well as the parameters used, but not had a comment as every second line of code, also I would comment any particularly tricky pieces of code. For a while on smaller projects I would also include a module called readme which would be filled with comments about program structure and flow, the things that might be system docs but then again who can ever find system docs for programs written years ago.
Anyway, hopefully this has given you something to think about over the weekend ;-)
In a thread a week or so ago, someone suggested that they were going to start a thread about the use of comments. As no one has so far taken this task in hand here are a few things to discuss.
Are comments a good thing or a bad thing, in that they become an excuse for not writing proper support documentation?
Does code written with clearly named variables(ie self describing code) need comments?
Is overcommented code as bad as poorly commented code?
At what size would a sub/function not need comments?
There are loads more things to be said about comments but hopefully these will start the ball rolling.
This has become a subject dear to my heart in the last few weeks. I have taken over a number of sizable VB projects which came with no commented code and minimal, if any, docs.
Some parts of the code have obviously been taken from the internet and MSDN and the only changes made to the code has been the removal of comment, go figure.
Personnally, I have always used comments at the start of a sub/function to describe it as well as the parameters used, but not had a comment as every second line of code, also I would comment any particularly tricky pieces of code. For a while on smaller projects I would also include a module called readme which would be filled with comments about program structure and flow, the things that might be system docs but then again who can ever find system docs for programs written years ago.
Anyway, hopefully this has given you something to think about over the weekend ;-)