Re: AspectJ: solution to Java's repetitiveness?
Eric Sosman wrote:
Lew wrote:
My point was not about comments in the code, but about the code itself
being self-documenting.
In the programming languages I have used over the past
four decades, I have not encountered even one in which it
is possible to write "self-documenting code." At the very
best (an ideal more often attempted than achieved), code on
its own can only describe the "what" but never the "why."
Which is why you need comments. As I stated, I believe that comments (should)
exist to explain why the code does what it does.
Or to put it another way: Remove all comments from your
latest piece of Java, and then defend the proposition that
the comment-less code is at least as good as the original.
Be sure to explain why the new Javadoc is as good as the old.
I agree with you. I am not one to defend the elimination of comments from
source code. /Au contraire/, my own code often contains more lines of Javadoc
and other comments than it does non-blank, non-brace-only lines of code.
Javadoc is a separate category in my mind from "ordinary" comments. Javadoc
is a manifestation of "literate programming", wherein the motivation,
algorithm and important points for usage are documented. Ordinary comments
exist to supplement what the code tells a maintainer, wherein the reasons for
code decisions and other matters of importance to coders can reside.
While Javadocs exist to provide API docs independently of the source, the fact
that they are embedded in the source is very helpful.
--
Lew