Re: Repetitive XML comments -- what's the point?
- From: "Bruce Wood" <brucewood@xxxxxxxxxx>
- Date: 6 Oct 2006 17:31:19 -0700
Mark Wilden wrote:
"Dave Sexton" <dave@jwa[remove.this]online.com> wrote in message
news:OyeO35Z6GHA.1484@xxxxxxxxxxxxxxxxxxxxxxx
These problems, where the intention differs from the actual are usually
referred to as "bugs"
Perhaps, but the actual could be the correct behavior and the intention
could be incorrect. What defines a "bug" is the degree to which a program
delivers a result that its users don't want. At the end of the day, it is
this that must be judged, not intentions (with which the road to hell is
paved with good ones).
I was going to say that you missed my point, but you're closing in on
it....
What comments give you (and I admit that unit tests provide a far more
accurate, if verbose and difficult-to-assimilate version) is what the
author believed should be happening. If the comments disagree with the
actual (as you termed it) -- and here's the key -- *one of them* must
be wrong. Either the comments are wrong or the code is wrong.
It's not that the comments tell you how things should be, rather that a
*disconnect* between the comments and the code tell you that something
is amiss.
Of course, if the comments and the code are in accord, there could
still be a bug, but then it's a higher-level conceptual bug, not a
coding bug.
I *do* care what the original programmer believed should be going on,
because when I'm repairing defects I want to get my head around his/her
original design. Usually there are three or four ways to fix a bug,
only one of which aligns nicely with the original thinking behind the
code. I don't want to waste my time fixing method A, only to find that
that means I have to fix method B, then method C, then method D, then
finally in method E I discover that the original design was to handle
the problem in there, and that was what was broken, not method A.
Nothing wrong with my fix, in a theoretical sense, other than that it
went against the grain of the original design.
True, in an ideal world I could just skim the code and divine the
original design from that, and many times I can, but not always. It's
nice to have some documentation to fall back on.
Of course, as you said, unit tests provide a definitive statement of
whether the parts of the system work as intended, but it's much harder
to wade through hundreds of unit tests to ask the question, "Did the
original author intend that this method explode when passed a null...
did he intend to handle that case somewhere else... of did he miss the
case entirely?"
.
- Follow-Ups:
- Re: Repetitive XML comments -- what's the point?
- From: Mark Wilden
- Re: Repetitive XML comments -- what's the point?
- References:
- Repetitive XML comments -- what's the point?
- From: tjb
- Re: Repetitive XML comments -- what's the point?
- From: Bruce Wood
- Re: Repetitive XML comments -- what's the point?
- From: Mark Wilden
- Re: Repetitive XML comments -- what's the point?
- From: Dave Sexton
- Re: Repetitive XML comments -- what's the point?
- From: Mark Wilden
- Repetitive XML comments -- what's the point?
- Prev by Date: Re: Application wide event?
- Next by Date: Re: c# 3.0 - when?
- Previous by thread: Re: Repetitive XML comments -- what's the point?
- Next by thread: Re: Repetitive XML comments -- what's the point?
- Index(es):
Relevant Pages
|