Re: Request for comments on simple Ada program
- From: Niklas Holsti <nobody@xxxxxxxxxx>
- Date: Wed, 16 Nov 2005 19:08:50 +0200
Jacob Sparre Andersen wrote:
Niklas Holsti wrote:
...
Jacob (who believes that the optimal comment/code ratio is zero)
On a philosophical level, I agree with you -- writing "comments" is an extra burden, and one risks contradictions between the comments and the code (I recall an article long ago in SIGPLAN Notices with the title "Comments considered harmful" :-)
An ideal language should be expressive and readable enough to stand on its own. Unfortunately, Ada -- or, to be fair, the way I use Ada -- is still too low-level for that. Perhaps some future aspect-oriented language...
My reason for mentioning what I believe is the optimal comment/code ratio, is actually due to an article in ACM Queue, where the authors used a code quality metric, which equalled more comments with higher code quality.
I agree that such a metric can be very misleading, because then you should measure the quality of the comments, too, which is impossible to automate. But I think anyone who has tried to reuse two code packages, one with (good) comments and the other without, must feel that there is *some* truth in the metric.
But I don't put the rationale in the source code. The rationale is kept in a separate file. What I still do put in the source code - and don't like putting there - is the abstracts for the subprograms and packages. But how can I easily cross-link the documentation (with the abstracts) and the code (with the implementations)? Should I cite the package name/full subprogram specification in the documentation to create the cross-link? Or can somebody come up with a more elegant solution?
There are some IDE-like commercial tools -- if memory serves, some sort of souped-up requirements databases + design tools + code generatorts with "automatic" document generation functions -- that claim to keep these cross-links for you. But burying my code in that sort of a monster machine makes me very nervous, and they aren't cheap either.
The conversation seems to be drifting towards Knuth's "literate programming". I think it is or was a good idea, but gave more benefit for Pascal than it would give for Ada, which can be more literate in itself. Perhaps the time is ripe for something like "checkable literate programming", modelled on SPARK, where the annotations/comments are readable and informative but also checkable?
--
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
. @ .
.- References:
- Request for comments on simple Ada program
- From: Maciej Sobczak
- Re: Request for comments on simple Ada program
- From: Samuel Tardieu
- Re: Request for comments on simple Ada program
- From: Jacob Sparre Andersen
- Re: Request for comments on simple Ada program
- From: Niklas Holsti
- Re: Request for comments on simple Ada program
- From: Jacob Sparre Andersen
- Request for comments on simple Ada program
- Prev by Date: Re: Request for comments on simple Ada program
- Next by Date: Re: Request for comments on simple Ada program
- Previous by thread: Re: Request for comments on simple Ada program
- Next by thread: Re: Request for comments on simple Ada program
- Index(es):
Relevant Pages
|
|