[Info-vax] Long uptime cut short by Hurricane Sandy
David Froble
davef at tsoft-inc.com
Sat Feb 2 13:21:41 EST 2013
Paul Sture wrote:
> In article <an0jjrFduj7U1 at mid.individual.net>,
> billg999 at cs.uofs.edu (Bill Gunshannon) wrote:
>
>> I've seen more comments in COBOL than in Ada. Does that make COBOL a
>> better language for writing an F16 Flight Control System?
>
> The problem I always found with COBOL is that you cannot put comments at
> the end of a line of code. Devoting whole lines to comments can split
> code which logically lies together.
>
> Or you write an essay at the beginning of the code. There are times
> when a couple of words at the end of a line need a whole sentence to
> describe when the comment is in a separate place.
>
For a long time now I've gravitated toward the "essay" approach.
For a programmer intending to perform maintenance, I'd expect the code
to be adequate, once the purpose has been declared.
For someone attempting to understand what the code does, the comments
are all that need be read.
That said, there are always instances where a comment on a particular
line can be very appropriate.
My problem with comments at the end of a line is that many times there
isn't adequate space for a decent explanation, and some coders might
shorten a comment to the point it can be worthless.
As an example of both:
(this will probably wrap and be ugly)
130 !************************************************
! Create Connection Socket
!************************************************
SOCKOPT::Protocol% = TCPIP$C_TCP ! Socket
characteristic
s
SOCKOPT::Typ$ = CHR$(TCPIP$C_STREAM)
SOCKOPT::AF$ = CHR$(TCPIP$C_AF_INET)
Stat% = SYS$QIOW( , ! Event flag &
Ch% By Value, ! VMS channel &
IO$_SETMODE By Value, ! Operation &
IOSB::Stat%, ! I/O status
block &
, ! AST routine &
, ! AST parameter &
SOCKOPT::Protocol%, ! P1 &
, ! P2 &
, ! P3 &
, ! P4 &
, ! P5 &
) ! P6
The (brief in this case) essay declares what's to happen, and the
comments on the QIOW might preclude the next reader of the code to need
to go to the doc to figure out the 12 parameters. Without the general
comment, such code might appear to be (can I say it?) cryptic ..
But that's just me ...
More information about the Info-vax
mailing list