ebook img

DTIC ADA242525: Ada Quality and Style: Guidelines for Professional Programmers PDF

198 Pages·8.6 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview DTIC ADA242525: Ada Quality and Style: Guidelines for Professional Programmers

AD-A242 525 TION PAGE .... ....... FImppOe - PL*roi HpnE.RmNk DGhNrO Wo eew atom am xaNr o.0 7a084=-0 18af"a aW m .aNn€lw IWWS ofa ny other aspea of the cooton of rdormaieon. wnckuvv kwegton for f~uc" "'utx o umio n HeSPNIn ITRNon. ( AND &wMHe N ay.S uit 1204. VA 22202-NAM2E to OfA oSI nSom10on anSPNSRIimT RINGAG ENCc. o 1.A GENC TE 3.R EPORT TYPE AND DATES COVERED F IN A L T P E TG O 14T.I TLE AND SUBTITLE 5 FUNDING NUMBERS Ada QUALITY AND STYLE: GUIDELINES FOR PROFESSIONAL PROGRAMMERS #E LE CT E l n SNOVI 1991 7.P ER FORMINlie ORGANIZATION NAM E(S) AND ADDR ESS(ES) -A 'l 8.P ERFORMING ORGANIZATION SOFTWA PRODUCTIVTY CONSORTIUM, INC. CRSRF D EPCE VERSTO N THE Sf OB UILDRI SCTIONS WILE THERE 2214 ROCK HILL RD HERNDON, VA 22070-4005 9.S PONSORING/MONITORING AGENCY NAME(S)A ND ADDRESS(ES) 10. SPONSORICNW ONITORING AGENCY Ada JOINT PROGRAM OFFICE REPORT NUMBER THE PENTAGON,R M.3 E1 18 1W3. AAUSHTRIN(aG TON, Du. C. 0200w30r1s-3081 11ISU.P PLEMENTARY NOTES 12a. DISTRIBUTION/AVAILABILIT'Y STATEMENT 12b. DISTRIBUTION CODE UNCLASSIFIED - UNLIMITED PUBLIC DISTRIBUTION 13. ABSTRACT IMaximum 200 words) THE SECOND EDITION HAS BEEN PRODUCED TO CORRECT, CLARIFY, AND ENHANCE VARIOUS TOPICS IN THE ORIGINAL VERSION. INSTANTIATIONS HAVE BEEN INCLUDED WITHIN RELEVANT SECTIONS. WHILE THERE HAVE BEEN CHANGES, ADDITIONS AND DELETIONS TO THE GUIDELINES, THE MAJOR CONCEPTUAL CHANGES HAVE BEEN IN THE FOLLOWING AREAS: USE OF OTHERS CLAUSE IN CASE STATENEBTS, USE OF WHILE LOOPS AND BLOCKS; EXCEPTION HANDLING, ANONYMOUS TASK TYPES, AND CONDITIONAL AND TIMED ENTRY CALLS. THE SECTIONS ON COMMENTS AND THE CHAPTER ON REUSE HAVE BEEN EXPANDED. THIS IS THE SUGGESTED Ada STYLE GUIDE FOR USE IN DoD PROGRAMS BY THE Ada JOINT PROGRAM OFFICE. 14. SUBJECT TERMS 15. NUMBER OF PAGES 180 Ada STYLE GUIDE 16. PRICE CODE 17. SECURITY CLASSIFICATION 18 SECURITY CLASSIFICATION I 19. SECURITY CLASSIFICATION 20. LIMITATION OF ABSTRACT OF REPORT I OF ABSTRACT UNCLASSIFIED UNCL ..... NSN 7540-01-2a0-550 Standard Form 298, (Rev. 2-89) Prescribed by ANSI Sid. 239-128 DISCLAIMER NOTICE THIS DOCUMENT IS BEST QUALITY AVAILABLE. THE COPY FURNISHED TO DTIC CONTAINED A SIGNIFICANT NUMBER OF PAGES WHICH DO NOT REPRODUCE LEGIBLY. A 2t2q S525 WZ ZZMSOFTWARE "'W PRODUCTIVITY ~WW CONSORTIUM Ada Quality and Style: Guidelines for Professional Programmers SPC-91061-N VERSION 02.00.02 1991 Software Productivity Consortium SPC Building 2214 Rock Hill Road Herndon, Virginia 22070-4005 Copyright © 1989, 1991 Software Productivity Consortium, Inc., Herndon, Virginia. Permission to use, copy, modify and distribute this documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appears in all copies and that both this copyright notice and this permission notice appear in supporting documentation, and that the name Software Productivity Consortium, Inc. not be used in advertising or publicity pertaining to distribution of the guidelines without specific, written prior permission. Software Productivity Consortium, Inc. makes no representations about the suitability of the guidelines described herein for any purpose. It is provided "as is" without express or implied warranty. Unlimited Distribution Ada Quality and Style: Guidelines for Professional Programmers SPC-91 061 -N VERSION 02.00.02 1991 6&6aFo I TAL -ULW La -1a ID~st ipe 0 a1 91-14786 PREFACE The second edition has been produced to correct, clarify, update and enhance various topics in the original version. The book has undergone minor restructuring. While the chapters remain the same, some of the sections have been rearranged for clarity. Also, instantiations have been included within relevant sections. In some sections, there is an additional subsection on automation. While there have been changes, additions and deletions to the guidelines, the major conceptual changes have been in the following areas: use of the others clause in case statements, use of while loops and blocks, exception handling, anonymous task types, and conditional and timed entry calls. The sections on comments and the chapter on reuse have been expanded. Additionally, some examples have been enhanced. We invite comments on this guidebook to continue enhancing its quality and usefulness. We will consider suggestions for current guidelines as well as areas for future expansion. Examples that highlight particular points are most helpful. Please direct comments to: Technology Transfer Division - AQS Software Productivity Consortium SPC Building 2214 Rock Hill Road Herndon, Virginia 22070-4005 (703) 742-7211 Please fill out and mail the registration form at the back of this document to receive updates and other information. iv Ada QUALITY AND STYLE v AUTHORS AND ACKNOWLEDGEMENTS The authors for the second edition are Kent Johnson, Elisa Simmons, and Fred Stluka. Contributors are Alex Blakemore and Robert Hofkin. Reviewers include Alex Blakemore, Rick Conn, Tim Harrison, Dave Nettles, and Doug Smith. Additional support has been provided by Vicki Clatterbuck, Leslie Hubbard, and Debra Morgan. The following people contributed to an instantiation of the first edition's guidelines: Rich Bechtold, Pete Bloodgood, Shawna Gregory, Tim Powell, Dave Nettles, Kevin Schaan, Doug Smith and Perry Tsacoumis. Special thanks are extended to Loral for providing feedback in the form of their Software Productivity Laboratory Ada Standards. The Consortium would also like to acknowledge those involved in the first edition. The authors were Richard Drake, Samuel Gregory, Margaret Skalko, and Lyn Uzzle. Managing the project was Paul Cohen. The contributors and reviewers were Mark Dowson, John Knight, Henry Ledgard, and Robert Mathis. Word processing was performed by Debra Morgan. Additional supporters included Bruce Barnes, Alex Blakemore, Terry Bollinger, Charles Brown, Neil Burkhard, William Carlson, Susan Carroll, John Chludzinski, Vicki Clatterbuck, Robert Cohen, Elizabeth Comer, Daniel Cooper, Jorge Diaz-Herrera, Tim Harrison, Robert Hofkin, Allan Jaworski, Edward Jones, John A.N: Lee, Eric Marshall, Charles Mooney, John Moore, Karl Nyberg, Arthur Pyster, Samuel Redwine, Jr., William Riddle, Lisa Smith, Fred Stluka, Kathy Velick, David Weiss, and Howard Yudkin. vi Ada QUALITY AND STYLE vii Ada QUALITY AND STYLE CONTENTS CHAPTER 1 Introduction ........................... 1 1.1 HOW TO USE THIS BOOK ..................................... 2 1.2 TO THE NEW Ada PROGRAMMER .............................. 3 1.3 TO THE EXPERIENCED Ada PROGRAMMER ..................... 3 1.4 TO THE SOFTWARE PROJECT MANAGER ....................... 3 CHAPTER 2 Source Code Presentation ................ 5 2.1 CODE FORMATTING .......................................... 5 2.2 SU M M A R Y .................................................. 15 CHAPTER 3 Readability .......................... 17 3.1 SP E L L IN G ................................................... 17 3.2 NAM ING CONVENTIONS ..................................... 19 3.3 COM M ENTS .............................................. . 24 3.4 U SIN G T Y PE S ............................................... 36 3.5 SU M M A RY .................................................. 37 CHAPTER 4 Program Structure ..................... 41 4.1 HIGH-LEVEL STRUCTURE .................................... 41 4.2 V ISIB IL IT Y .................................................. 45 4.3 EX C EPT IO N S ................................................ 50 4.4 SU M M A RY .................................................. 5 1 CHAPTER 5 Programming Practices ................ 55 5.1 OPTIONAL PARTS OF THE SYNTAX ........................... 55 5.2 PARA M ETER LISTS .......................................... 58 5 .3 T Y P E S .. .. .. .. .. .. .. .. . .. ... .. .. .. .. .. .. .. .. .. . .. .. .. .. .. .. . 6 2 5.4 DATA STRUCTURES ......................................... 64 5.5 EX PRESSIO N S ............................................ . 66 5.6 ST A T EM EN T S ............................................... 70 5.7 V ISIBILITY ..... .................................... . 77 5.8 USING EXCEPTIONS ......................................... 79 5.9 ERRONEOUS EXECUTION .................................... 81 5.10 SU M M A R Y .................................................. 85 vii viii Ada QUALITY AND STYLE CHAPTER 6 Concurrency ......................... 89 6.1 T A SK IN G ................................................... 89 6.2 COM M UNICATION ........................................... 94 6.3 TERM INATION ............................................. 100 6.4 SU M M A RY ................................................. 103 CHAPTER 7 Portability ............................ 105 7.1 FUNDAM ENTALS ........................................... 106 7.2 NUMERIC TYPES AND EXPRESSIONS ......................... 109 7.3 STORAGE CONTROL ........................................ 112 7.4 T A SK IN G .................................................. 113 7.5 EX C EPT IO N S ............................................... 115 7.6 REPRESENTATION CLAUSES AND IMPLEMENTATION- DEPENDENT FEATURES ..................................... 116 7.7 IN PUT/O UTPUT ............................................. 119 7.8 SU M M A RY ................................................. 120 CHAPTER 8 Reusability .......................... 123 8.1 UNDERSTANDING AND CLARITY ............................ 124 8.2 RO BU STN ESS ............................................... 125 8.3 A DA PTA BILITY ............................................. 130 8.4 IN D EPEN D ENCE ............................................ 140 8.5 SU M M A RY ................................................. 142 CHAPTER 9 Instantiation ........................ 145 9.1 HORIZONTAL SPACING ..................................... 145 9.2 IN D EN TA T IO N .............................................. 146 9.3 MORE ON ALIGNM ENT ..................................... 148 9.4 PA G IN A T IO N ............................................... 148 9.5 SOURCE CODE LINE LENGTH ............................... 148 9.6 N U M B E RS .................................................. 149 9.7 CA PITA LIZATIO N .......................................... 149 9.8 FILE H EA D ERS ............................................. 149 9.9 PROGRAM UNIT SPECIFICATION HEADER .................... 149 9.10 PROGRAM UNIT BODY HEADER ............................. 150 9.11 NAM ED ASSOCIATION ...................................... 150 9.12 ORDER OF PARAMETER DECLARATIONS ..................... 151 9 .13 N E ST IN G ................................................... 15 1 9.14 GLOBAL ASSUM PTIONS ..................................... 151 CHAPTER 10 Complete Example .................. 153 APPENDIX A - Map from Ada Language Reference Manual to Guidelines .............. 163 REFERENCES ................................. 169 BIBLIOGRAPHY ................................. 172 INDEX ......................................... 175 viii

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.