From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.0 required=3.0 tests=BAYES_20 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: Mon, 9 Sep 91 15:31 GMT From: Frank Pappas <0004238973@mcimail.com> Subject: Ada micro style for programs in introductory textbooks Message-ID: <23910909153132/0004238973NC2EM@mcimail.com> List-Id: > 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.