I do believe that light commenting is good.
In your bullets, you make the following points:
-
helps clarify the problem before coding
Yes, but sometimes these notes should be kept separate as design documentation. Some of this can also be done by writing tests.
Here you are saying they have served their purpose already; you need another purpose to shove them into the code.
-
reminds you ... what you thought you were doing.
This is true, but it is could also true of the code itself.
This can also be done with tests.
-
[make] obvious that there's a mismatch between what was intended and what's been written
No, this is like having two compasses that don't agree. Well, if you're the author, it can work until tickling your memory doesn't help.
Expressing your intentions for some code can be more precisely done by tests.
-
make you to consider edge conditions and check [them]
Better done by testing.
-
require you to express and examine assumptions.
Better done by testing.
-
justify and document the choice of algorithm or method.
Agreed.
-
leave notes on things which were not obvious when you worked out what needed to be done or how to do it
What is being done and how it is being done is captured
in the code; the mindset of a maintainer with the artifact
of the code before him may not mirror that of the writer
who sat down with no code in front of him.
-
and so on.
May your comments not be so vague, :-)
and testing will probably help with whatever this is :-).
Be well, rir
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|