Lacking Natural Simplicity

Random musings on books, code, and tabletop games.

Ada Quality and Style: Guidelines for Professional Programmers

The Ada Quality and Style: Guidelines for Professional Programmers is available on the web, but I don't think that there is a PDF copy anywhere easily found, so I'm making a copy available here. This is the style guide for Ada 83, by the way. I got it from the Ada Information Clearinghouse. I downloaded the file style-ps.zip into a temporary directory and then ran the shell script make-83style-pdf.sh to create the PDF file:

#! /usr/bin/env bash
# First, unzip style-ps.zip.  Then, in another directory, unzip all six of
# those zip files.  Then do the following:
set -x
mkdir tmp &&
    cd tmp &&
    unzip -L ../style-ps.zip &&
    mkdir tmp &&
    cd tmp &&
    for i in ../*.zip; do unzip -L $i; done  &&
    for i in *.ps; do ps2pdf $i $(basename $i .ps).pdf; done &&
    qpdf --empty -pages covers.pdf 1-3 -- covers_fixed.pdf &&
    pdfunite covers_fixed.pdf preface.pdf ack.pdf toc.pdf intro.pdf source_c.pdf readabil.pdf prog_str.pdf prog_pra.pdf concurr.pdf portabil.pdf reuse.pdf performa.pdf complete.pdf appendix.pdf ref.pdf bib_0188.pdf index.pdf 83style.pdf

Note the qpdf command? That pulls out the first three pages of covers.pdf, because the other pages duplicate stuff that is in the other .pdf files.

Then I read through the PDF and made a bookmarks file for use with jpdfbookmarks (I use one of the releases from this github repo):

Ada Quality and Style/1
        Cover 1/1
        Cover 2/2
        Preface/4
        Authors and Acknowledgements/6
        Contents/8
        Chapter 1: Introduction/10
                1.1 How to use this book/11
                1.2 To the new Ada programmer/11
                1.3 To the experienced Ada programmer/12
                1.4 To the software project manager/12
                1.5 to contracting agencies and standards organizations/13
        Chapter 2: Source Code Presentation/14
                2.1 Code formatting/14
                        2.1.1 Horizontal spacing/14
                        2.1.2 Indentation/15
                        2.1.3 Alignment of operators/18
                        2.1.4 Alignment of declarations/19
                        2.1.5 More on alignmeent/20
                        2.1.6 Blank lines/21
                        2.1.7 Pagination/22
                        2.1.8 Number of statements per line/23
                        2.1.9 Source code line length/24
                2.2 Summary/24
        Chapter 3: Readability/26
                3.1 Spelling/26
                        3.1.1 Use of underscores/26
                        3.1.2 Numbers/26
                        3.1.3 Capitalization/27
                        3.1.4 Abbreviations/28
                3.2 Naming conventions/29
                        3.2.1 Names/29
                        3.2.2 Type names/29
                        3.2.3 Object names/30
                        3.2.4 Program unit names/31
                        3.2.5 Constants and named numbers/32
                3.3 Comments/33
                        3.3.1 General comments/34
                        3.3.2 File headers/35
                        3.3.3 Program unit specification header/35
                        3.3.4 Program unit body header/38
                        3.3.5 Data comments/39
                        3.3.6 Statement comments/41
                        3.3.7 Marker comments/43
                3.4 Using types/44
                        3.4.1 Declaring types/44
                        3.4.2 Enumeration types/45
                3.5 Summary/46
        Chapter 4: Program Structure/50
                4.1 High level structure/50
                        4.1.1 Separate compilation capabilities/50
                        4.1.2 Subprograms/51
                        4.1.3 Functions/52
                        4.1.4 Packages/53
                        4.1.5 Cohesion/53
                        4.1.6 Data coupling/54
                        4.1.7 Tasks/54
                4.2 Visibility/55
                        4.2.1 Minimization of interfaces/55
                        4.2.2 Nested packages/56
                        4.2.3 Restricting visibility/56
                        4.2.4 Hiding tasks/57
                4.3 Exceptions/59
                        4.3.1 Using exceptions to help define an abstraction/59
                4.4 Summary/61
        Chapter 5: Programming Practices/64
                5.1 Optional parts of the syntax/64
                        5.1.1 Loop names/64
                        5.1.2 Block names/65
                        5.1.3 Exit statements/66
                        5.1.4 Naming end statemnts/66
                5.2 Parameter lists/67
                        5.2.1 Formal parameters/67
                        5.2.2 Named association/67
                        5.2.33 Default parameters/68
                        5.2.4 Mode indication/69
                5.3 Types/69
                        5.3.1 Derived types and subtypes/69
                        5.3.2 Anonymous types/71
                        5.3.3 Private types/71
                5.4 Data structures/72
                        5.4.1 Heeterogeneous data/72
                        5.4.2 Nested records/73
                        5.4.3 Dynamic data/74
                5.5 Expressions/75
                        5.5.1 Range values/75
                        5.5.2 Array attributes/76
                        5.5.3 Parenthetical expressions/76
                        5.5.4 Positive forms of logic/77
                        5.5.5 Short circuit forms of the logical operators/77
                        5.5.6 Accuracy of operations with real operands/78
                5.6 Statements/78
                        5.6.1 Nesting/78
                        5.6.2 Slices/80
                        5.6.3 Case statements/80
                        5.6.4 Loops/81
                        5.6.5 Exit statements/82
                        5.6.6 Recursion and iteration bounds/83
                        5.6.8 Return statements/84
                        5.6.9 Blocks/85
                        5.6.10 Aggregates/86
                5.7 Visibility/86
                        5.7.1 The use clause/87
                        5.7.2 The renames clause/88
                        5.7.3 Overloaded subprograms/88
                        5.7.4 Overloaded operators/89
                        5.7.5 Overloading the equality operator/89
                5.8 Using exceptions/89
                        5.8.1 Handling versus avoiding exceptions/90
                        5.8.2 Handlers for others/90
                        5.8.3 Propagation/91
                        5.8.4 Localizing the causes of an exception/91
                5.9 Erroneous Execution/92
                        5.9.1 Unchecked conversion/92
                        5.9.2 Unchecked deallocation/93
                        5.9.3 Dependeence on parameter passing mechanism/93
                        5.9.4 Multiple address clauses/94
                        5.9.5 Suppression of exception check/94
                        5.9.6 Initialization/94
                        5.9.7 Direct_IO and Sequential_IO/95
                        5.9.8 Incorrect order dependencies/96
                5.10 Summary/96
        Chapter 6: Concurrency/100
                6.1 Tasking/100
                        6.1.1 Tasks/100
                        6.1.2 Anonymous task types/101
                        6.1.3 Dynamic tasks/102
                        6.1.4 Prioritis/103
                        6.1.5 Delay statements/104
                6.2 Commmunication/105
                        6.2.1 Effecient task communications/105
                        6.2.2 Defensive task communication/106
                        6.2.3 Attributes 'Count, 'Callable, and 'Terminated/108
                        6.2.4 Shared variables/109
                        6.2.5 Tenative rendezvous constructs/111
                        6.2.6 Commmunication complexity/112
                6.3 Termination/113
                        6.1.1 Avoiding termination/113
                        6.3.2 Normal termination/114
                        6.3.3 The abort statement/115
                        6.3.4 Abnormal termination/115
                6.4 Summary/116
        Chapter 7: Portability/118
                7.1 Fundamentals/119
                        7.1.1 Global assumptions/119
                        7.1.2 Actual limits/120
                        7.1.3 Comments/120
                        7.1.4 Main subprogram/121
                        7.1.5 Encapsulating implementation dependencies/121
                        7.1.6 Implementation-added features/122
                7.2 Numeric types and expressions/122
                        7.2.1 Predefined numeric types/122
                        7.2.2 Ada model/123
                        7.2.3 Analysis/123
                        7.2.4 Accuracy Constraints/124
                        7.2.5 Comments/124
                        7.2.6 Precision of constants/124
                        7.2.7 Subexpression evaluation/124
                        7.2.8 Relational tests/124
                7.3 Storage control/125
                        7.3.1 Representation clause/125
                7.4 Tasking/126
                        7.4.1 Task activation order/126
                        7.4.2 Delay statements/126
                        7.4.3 Package Calendar, type Duration, and System.Tick/126
                        7.4.4 Select statement evaluation ordr/126
                        7.4.5 Task scheduling algorithm/127
                        7.4.6 Abort/127
                        7.4.7 Shared variables and pragma shared/127
                7.5 Exceptions/127
                        7.5.1 Predefined exceptions/127
                        7.5.2 Constraint_Error and Numeric_Error/128
                        7.5.3 Implementation-defined exceptions/128
                7.6 Representationi clauses and implementation dependent features/128
                        7.6.1 Representation clauses/129
                        7.6.2 Package System/129
                        7.6.3 Machine code inserts/129
                        7.6.4 Interfacing Foreign Languages/130
                        7.6.5 Implementation-defined pragmas and attributes/130
                        7.6.6 Unchecked deallocation/130
                        7.6.7 Unchecked conversion/131
                7.7 Input/output/131
                        7.7.1 Name and Form parameters/132
                        7.7.2 File closing/132
                        7.7.3 I/O on access types/132
                        7.7.4 Package Low_Level_IO/132
                7.8 Summmary/133
        Chapter 8: Reusability/136
                8.1 Understanding and clarity/137
                        8.1.1 Application-independent naming/137
                        8.1.2 Abbreviations/138
                        8.1.3 Generic formal parameters/139
                8.2 Robustness/139
                        8.2.1 Named numbers/139
                        8.2.2 Unconstrained arrays/140
                        8.2.3 Assumptions/140
                        8.2.4 Subtypes in generic specifications/141
                        8.2.5 Overloading in generic units/143
                        8.2.6 Hidden tasks/143
                        8.2.7 Exceptions/143
                8.3 Adaptability/145
                        8.3.1 Complete functionality/145
                        8.3.2 Generic units/146
                        8.3.3 Using generic units to encapsulate algorithms/146
                        8.3.4 Using generic units for abstract data types/148
                        8.3.5 Iterators/151
                        8.3.6 Private and limited private types/154
                8.4 Independence/156
                        8.4.1 Using generic parameters to reduce coupling/156
                        8.4.2 Coupling due to pragmas/157
                        8.4.3 Part families/158
                        8.4.4 Conditional compilation/158
                        8.4.5 Table-driven programming/159
                8.5 Summary/160
        Chapter 9: Performance/162
                9.1 Improving exception speed/162
                        9.1.1 Pragma inline/162
                        9.1.2 Blocks/163
                        9.1.3 Arrays/163
                        9.1.4 Mod and rem operators/164
                        9.1.5 Constraint checking/164
                9.2 Summmary/165
        Chapter 10: Complete Examples/166
                10.1 Menu-driven user interface/166
                10.2 Line-oriented portablee dining philosophers example/174
                10.3 Window-oriented portable dining philosophers example/179
        Appendix A: Map from Ada Language Referencee Manual to Guidelines/188
        References/194
        Bibliography/198
        Index/202

Then I ran another shell script, build-bookmarks.sh:

#! /usr/bin/env bash

jpdfbookmarks -f tmp/tmp/83style.pdf --apply 83style.bookmarks --out 83style.pdf

There is a PDF of the style guide for Ada 95 online, but the links to the other formats listed on the Ada 95 Documents page have bit rotted, alas.

Print Friendly and PDF

Comments

Comments powered by Disqus