comp.lang.ada
 help / color / mirror / Atom feed
* Re: Coding Standards
@ 1996-05-17  0:00 W. Wesley Groleau (Wes)
  1996-05-28  0:00 ` Ken Garlington
  0 siblings, 1 reply; 18+ messages in thread
From: W. Wesley Groleau (Wes) @ 1996-05-17  0:00 UTC (permalink / raw)



After I said:
>> Indeed, if you can't understand or maintain the code without the standard,
>> then the coding standard is not making the code more maintainable, is it?

R.D. answered:
> By the same argument, why should programmers have to read the Ada
> manual?  After all, if you can't understand or maintain the code without
> the Standard, then the language standard is not making the code more
> readable.  For example, if you don't understand the type checking rules,
> then type checking won't help you understand the program.  ;-)
>
> I can assure you that if you work on a project where I'm the boss, and
> it's written in Ada, you will be required to know Ada, and to know
> project-wide conventions about Ada, and so on.

I think you're reading too much into my comment.  I was not criticizing
your initialization convention (I'm still undecided on that).  Nor did
I suggest that programmers be allowed to shrug off coding standards.
(People that have worked with me know I can be a bit of a curmudgeon
about format and style.)

But the main point of coding standards is maintainability via readability.
I believe that the code should be as clear as possible to the READER without
external support.  There is a difference between a feature of the language
that supports reliability in general and a local convention that adds
semantics to the code.

Readability was one of the original goals of Ada.  If we really wanted to
make sure that people used the standards and references extensively, we
could have derived Ada from RPG, APL, and C rather than Algol and Pascal. :-)

I want the customer, outside consultants, future maintainers, etc.--who may
not be able to find (or who may not be obligated to) a coding standard that
may no longer be valid--to understand the code.  Now if they are going to
change it, yes, I will vigorously defend the current coding standards of
the project.

---------------------------------------------------------------------------
W. Wesley Groleau (Wes)                                Office: 219-429-4923
Senior Software Engineer - AFATDS                         FAX: 219-429-5194
Magnavox - Mail Stop 10-40                               Home: 219-471-7206
1010 Production Road                QuickMail (Mac): wwgrol@most.fw.hac.com
Fort Wayne,  IN   46808              elm (Unix): wwgrol@pseserv3.fw.hac.com
---------------------------------------------------------------------------




^ permalink raw reply	[flat|nested] 18+ messages in thread
* Is there an ADA analogue to the C++ continue statement?
@ 1997-09-17  0:00 Heath, Terry D.
  1997-09-18  0:00 ` Pascal Obry
  0 siblings, 1 reply; 18+ messages in thread
From: Heath, Terry D. @ 1997-09-17  0:00 UTC (permalink / raw)



Almost all of my programming is done in C++, and I have never
programmed in Ada (my loss!), although I have seen some examples of
Ada syntax.

I am curious, does Ada have a statement analogous to the C++ continue
statement (see immediately below) ?

EXAMPLE OF C++ CONTINUE STATEMENT:

         while (condition-1)
               {
                     statement-1;

                     if (condition-2)
                         continue;

                     statement-3;
                }

In the above, if condition-2 evaluates to be true, then flow of
control is immediately transferred back to the top of the while loop
(where condition-1 is then tested for, in order to determine whether
iteration of the while loop is to continue).

Note, although the word 'continue' might suggest a NOP type
instruction (NOP = No OPeration ... just continue forward!), that is
not what occurs in C++ (instead, a jump occurs as described in the
previous sentence)  ...  they should have chosen a better name for
the statement !

That is, the C++ continue statement has the opposite effect to the
Ada exit statement (the former transfers flow of control to the start
of the loop construct, whereas the latter transfers control to the
end of the loop construct).

Certainly, the pattern of execution defined by the pseudo-code above
can be implemented by way of traditional structured programming
techniques without recourse to a 'continue' type statement such as
that above.  Nonetheless, I believe the flow of control defined by
the pseudo-code above to be consistent with all widely accepted
structured programming principles (after all, it is just the reverse
concept of that underpinning the Ada exit statement).

So, does Ada have a statement analogous to the C++ continue statement
?

Thanks in advance,
Terry. 





^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: Coding Standards
@ 1996-05-29  0:00 W. Wesley Groleau (Wes)
  1996-05-29  0:00 ` Robert A Duff
  1996-05-29  0:00 ` Ken Garlington
  0 siblings, 2 replies; 18+ messages in thread
From: W. Wesley Groleau (Wes) @ 1996-05-29  0:00 UTC (permalink / raw)



I (Wes) wrote:

>> Now if they are going to
>> change it, yes, I will vigorously defend the current coding standards of
>> the project.

Ken Garlington then asked:

>Do you defent the _current_ coding standards of the project, or the
>standards under which the code was originally written? It seems to me that,
>if you follow Mr. Duff's approach to coding standards, two things happen:

The CURRENT standards.  In maintaining and/or re-using code, I have two
rules:

1. If it ain't broke, don't fix it.

2. If it ain't easy to understand, it's broke.

The hard part is defining "easy"  :-)  Most people only want to go by rule #1;
a few of us (myself included) have to be restrained from applying rule # 2 to
90 per cent of existing code!  :-)

>[valid objections skipped]

Those objections are why I agree with you that

>It seems to me that it is not a good idea to have things in coding standards
>that (a) relate to the meaning of the program and (b) are not obvious
>without referring to those standards.

Bob Duff asked why expecting code readers to know the coding standard was
different from expecting them to know the LRM.  To which I (not very clearly)
stated I want READERS to not need ANY outside source--not even the LRM.
But WRITERS had better know the LRM, the local standards, accepted practice,
and much more.

>Here's one common coding standard example which I think violates this rule
(and which I don't like). Many coding standards have a comment in their
prologue that says:

I'll spare you folks my strong opinions on unnecessary duplication.
--
---------------------------------------------------------------------------
W. Wesley Groleau (Wes)                                Office: 219-429-4923
Magnavox - Mail Stop 10-40                               Home: 219-471-7206
Fort Wayne,  IN   46808              elm (Unix): wwgrol@pseserv3.fw.hac.com
---------------------------------------------------------------------------




^ permalink raw reply	[flat|nested] 18+ messages in thread
* Coding Standards
@ 1996-05-15  0:00 W. Wesley Groleau (Wes)
  1996-05-15  0:00 ` Robert A Duff
  1996-05-16  0:00 ` Ken Garlington
  0 siblings, 2 replies; 18+ messages in thread
From: W. Wesley Groleau (Wes) @ 1996-05-15  0:00 UTC (permalink / raw)



If you haven't been following a recent "wordy" but interesting thread
in comp.lang.ada, one of the participants made a pithy point that's
worth repeating:

"... goal should be coding standards that make it easy to read the code,
not code that makes it necessary to read the coding standards."

Indeed, if you can't understand or maintain the code without the standard,
then the coding standard is not making the code more maintainable, is it?

--
---------------------------------------------------------------------------
W. Wesley Groleau (Wes)                                Office: 219-429-4923
Magnavox - Mail Stop 10-40                               Home: 219-471-7206
Fort Wayne,  IN   46808              elm (Unix): wwgrol@pseserv3.fw.hac.com
---------------------------------------------------------------------------




^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~1997-09-23  0:00 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-05-17  0:00 Coding Standards W. Wesley Groleau (Wes)
1996-05-28  0:00 ` Ken Garlington
  -- strict thread matches above, loose matches on Subject: below --
1997-09-17  0:00 Is there an ADA analogue to the C++ continue statement? Heath, Terry D.
1997-09-18  0:00 ` Pascal Obry
1997-09-19  0:00   ` Robert Dewar
     [not found]     ` <3422F037.41CA@lmco.com>
1997-09-20  0:00       ` dan13
1997-09-21  0:00         ` Robert Dewar
     [not found]           ` <3426B51E.7296@lmco.com>
1997-09-23  0:00             ` Coding Standards W. Wesley Groleau x4923
1996-05-29  0:00 W. Wesley Groleau (Wes)
1996-05-29  0:00 ` Robert A Duff
1996-05-29  0:00 ` Ken Garlington
1996-05-15  0:00 W. Wesley Groleau (Wes)
1996-05-15  0:00 ` Robert A Duff
1996-05-28  0:00   ` Ken Garlington
1996-05-28  0:00   ` Ken Garlington
1996-05-28  0:00     ` Robert A Duff
1996-05-29  0:00       ` Ken Garlington
1996-05-30  0:00       ` Frank Manning
1996-05-16  0:00 ` Ken Garlington
1996-05-17  0:00   ` Richard A. O'Keefe
1996-05-17  0:00     ` Ken Garlington
1996-05-20  0:00       ` Richard A. O'Keefe
1996-05-20  0:00         ` Ken Garlington

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox