comp.lang.ada
 help / color / mirror / Atom feed
From: Frank Pappas <0004238973@mcimail.com>
Subject: Ada micro style for programs in introductory textbooks
Date: Mon, 9 Sep 91 15:31 GMT	[thread overview]
Message-ID: <23910909153132/0004238973NC2EM@mcimail.com> (raw)

>  I recently received some reviews for a CS 1 (Introduction to
>Programming) in Ada textbook. I was criticized (to varying degrees) for not
>typesetting my Ada code according to the standard established in the LRM.
>
  First of all Rich, you should thank the reviewers for having read
the book before critiquing it!

>I would like to appeal to the net for some advice.  Should I toss
out my own style and typest my code exactly like the LRM?
>

  I don't understand why so many people feel they have to follow the
LRM conventions for identifiers. Was it really the intetion to make
these conventions the standard? How were they arrived at? Perhaps one
of the distinguished reviewers will let us know what the thinking
was. Since so many people follow the LRM conventions, maybe the
conventions should be reevaluated for Ada 9X.

  Personally, I find the use of all uppercase words difficult to
read except in special cases, e.g. system-dependent identifiers and
pragmas. Using uppercase seems appropriate when someone reading the
program should pay particular attention to these words.

  I view reserved words as signposts that someone reading a program
should be aware of, however, reserved words shouldn't draw attention
away from the rest of the program text. To me, this means lowercase
is appropriate.

  Capitalizing the remaining words seems preferable to writing in a
single case. English text isn't written that way, so it doesn't seem
reasonable that programs should be. All uppercase probably goes
back to the days when keypunches only produced uppercase.

  The book
                 Ada in Practice
                 Christine Ausnit, Norman Cohen,
                 John Goodenough, and Sterling Eanes
                 published by Springer-Verlag, 1985

contains a number of case studies performed for the Army on some
early Ada programs. The authors examined the software and used it as
a source of examples for studies on naming conventions, use of
exceptions, program structure, etc. Although a few years old, I think
the book is still worth reading.

  The chapter on naming conventions is something every programmer should
read. (It's a great source of ideas for coming up with project naming
conventions, etc.) With a reasonable set of naming conventions, a
preference for mixed case becomes obvious. Here's a paragraph from
the chapter:

     "By using mixed case, sequences of initials stand out
      and are not mistaken for words or truncations of words.
      An identifier like BAD_RIS appears to be talking about
      something called a RIS; when written as Bad_RIs, however,
      it more obviously refers to bad R.I.'s. Similarly, plural
      abbreviations like PHYS_IDS are more easily recognized when
      the identifiers are written as Phys_IDs."

  As for what conventions should be used in a text on Ada, I think
any well thought out, consistent convention that the author believes
improves readability is fine. Whether reviewers agree with the
conventions doesn't matter. This is especially true when the ar
has used the conventions in teaching and found them to work well.

             reply	other threads:[~1991-09-09 15:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1991-09-09 15:31 Frank Pappas [this message]
  -- strict thread matches above, loose matches on Subject: below --
1991-09-10 16:36 Ada micro Style for Programs in Introductory Textbooks Mr. D. Harter
1991-09-10  3:47 Robert I. Eachus
1991-09-06 21:09 david.c.willett
1991-09-06 19:56 munck
1991-09-06 18:06 agate!bionet!ucselx!sol.ctr.columbia.edu!spool.mu.edu!tulane!uno.edu!JNCS
1991-09-06 17:48 MARTIN%SCRANTON.BITNET
1991-09-06 12:50 europa.asd.contel.com!darwin.sura.net!noc.sura.net!haven.umd.edu!cs.wvu.w
1991-09-06 10:25 cis.ohio-state.edu!zaphod.mps.ohio-state.edu!caen!uvaarpa!vger.nsu.edu!g_
1991-09-06  2:35 cis.ohio-state.edu!zaphod.mps.ohio-state.edu!usc!elroy.jpl.nasa.gov!jpl-d
1991-09-05 23:52 munnari.oz.au!yoyo.aarnet.edu.au!sirius.ucs.adelaide.edu.au!chook.cs.adel
1991-09-05 21:53 David Eichmann
1991-09-05 21:00 Bill Yow
replies disabled

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