Dave,
I feel we are both saying the same here, and I am not sure why we are
still discussing this. I will try just once more time:
The "subject" of this thread is
"Repetitive XML comments -- what's the point?"
You might or not might agree that repetitive comments exist, but this
is other subject. I think they exist, as in the parameterless string
constructor example. Yes, it initializes a string class. There is no
much more you can say here that is not said on the "string"
documentation. Adding a comment here is like the classical:
i++; //increment i
Under the original thread, the original poster said that *if* you have
redundant comments, it was better not to document them at all.
What I answered, is that if you do not document even things that need
no documentation, you can not actually use the warnings to find out
things that you didn't document.
That's it. There is nothing about making documentation stubs or
anything. This was about documenting obvious things.
String Constructor [C#]
Initializes a new instance of the String class.
The sample
documentation is an example of poor documentation, IMO.
Well, here is a point I disagree. Adding lots of trivial explanations
because there is nothing else to say is IMHO an example of poor
documentation.
String Constructor [C#]
Initializes a new instance of the String class. The string class is ...
(reinclude all information that is already on the information for the
class, ot other information that will not help you at all to construct
a string)
That is poor documentation. Documentation should be all that is needed,
but no more. If there is nothing to say, say nothing.
BTW, each string constructor overload contains a remarks section and
additional information in the summary.
Yep, but I was speaking about the parameterless contructor. Almost
every class has a parameterless constructor, and most of the time what
all you can say about it is "constructs a new instance of MyClass" And
this is good. If the constructor needs more documentation, probably
there is something wrong with it.
These are not good examples of "redundant comments", as I understand
it. The particular definition you have cited is on the "overloads"
page which is not directly supported by C# commenting and also
includes an example anyway.
The comments on the overrloaded methods are different comments. On the
code, you have:
///<summary>
/// Initializes a new instance of the String class.
///</summary>
public String()
{
}
This comment is completely useless, and the fact that the overloads
might have useful comments and examples, does not make this particular
comment more useful.
I disagree. I believe what's useful about the warnings is that it's
telling you that you still have hundreds of undocumented elements in
your project.
Again, I agree 100%, but we are not discussing this. We are discussing
"What do you do if you find a method that (you feel) does not need
documentation?"
I see 3 options:
1) You do not document it. this was what the OP suggested, and I said
that this will not allow you to use the warnings.
2) You state the obvious. This is what I do, and even when I might not
like it much, it works.
3)No method on your code is so straightforward that you can not add
anything that is not obvious. You think long enough, and you find out
you have something to say. If you still don't, you make the method less
straightforward.
do you see any other option? Sometimes reading this, it seems like you
are advocating 3).
Again, I don't think that "redundant" documentation is good
documentation and this was my concern with your response.
Yes, I agree option 2) is the lesser of 3 evils. But IMHO is better
than 1) or 3)
If the best you can do is "Constructs a new instance of Type A",
then that's the best you can do. But at least you verified it. I
think part > of the cause of poor documentation is the assumption that
your making
when saying "5000 warnings on redundant constructors".
And this is what I have been saying all along!
Let's recap:
We agree we want 0 warnings on our final (shipping) code. We use
warnings to review what is left, and we try to make the best comments
when we can.
We agree that "If the best you can do is "Constructs a new instance of
Type A", then that's the best you can do. But at least you verified
it."
So we write "constructs a new instance of type A", verified it, and we
get one warning less, that will allow use to focus on the real warnings.
I still do not know what we are discussing about. It seems to me that
all the misunderstandings come form the fact that you assumed that I
was advocating to stub all documentation to claim "zero warnings", but
I never said something like that. In fact, as stated before, I normaly
code documentation with the code, because IME, when you have ideas
fresh is when you document best. If later you refactor, you refactor
the comments too. It is not that hard.
Regards,
Adrian.