[Ada Information Clearinghouse]

Ada '83 Quality and Style:

Guidelines for Professional Programmers

Copyright 1989, 1991,1992 Software Productivity Consortium, Inc., Herndon, Virginia.

Detailed table of contents

Copyright, Trademarks, Preface, Authors and Acknowledgements
CHAPTER 1: Introduction
1.1 How To Use This Book
1.2 To The New Ada Programmer
1.3 To The Experienced Ada Programmer
1.4 To The Software Project Manager
1.5 To Contracting Agencies And Standards Organizations
CHAPTER 2: Source Code Presentation
2.1 Code Formatting
2.1.1 Horizontal Spacing
2.1.2 Indentation
2.1.3 Alignment of Operators
2.1.4 Alignment of Declarations
2.1.5 More on Alignment
2.1.6 Blank Lines
2.1.7 Pagination
2.1.8 Number of Statements Per Line
2.1.9 Source Code Line Length
2.2 Summary
CHAPTER 3: Readability
3.1 Spelling
3.1.1 Use of Underscores
3.1.2 Numbers
3.1.3 Capitalization
3.1.4 Abbreviations
3.2 Naming Conventions
3.2.1 Names
3.2.2 Type Names
3.2.3 Object Names
3.2.4 Program Unit Names
3.2.5 Constants and Named Numbers
3.3 Comments
3.3.1 General Comments
3.3.2 File Headers
3.3.3 Program Unit Specification Header
3.3.4 Program Unit Body Header
3.3.5 Data Comments
3.3.6 Statement Comments
3.3.7 Marker Comments
3.4 Using Types
3.4.1 Declaring Types
3.4.2 Enumeration Types
3.5 Summary
CHAPTER 4: Program Structure
4.1 High-Level Structure
4.1.1 Separate Compilation Capabilities
4.1.2 Subprograms
4.1.3 Functions
4.1.4 Packages
4.1.5 Cohesion
4.1.6 Data Coupling
4.1.7 Tasks
4.2 Visibility
4.2.1 Minimization of Interfaces
4.2.2 Nested Packages
4.2.3 Restricting Visibility
4.2.4 Hiding Tasks
4.3 Exceptions
4.3.1 Using Exceptions to Help Define an Abstraction
4.4 Summary
CHAPTER 5: Programming Practices
5.1 Optional Parts of the Syntax
5.1.1 Loop Names
5.1.2 Block Names
5.1.3 Exit Statements
5.1.4 Naming End Statements
5.2 Parameter Lists
5.2.1 Formal Parameters
5.2.2 Named Association
5.2.3 Default Parameters
5.2.4 Mode Indication
5.3 Types
5.3.1 Derived Types and Subtypes
5.3.2 Anonymous Types
5.3.3 Private Types
5.4 Data Structures
5.4.1 Heterogeneous Data
5.4.2 Nested Records
5.4.3 Dynamic Data
5.5 Expressions
5.5.1 Range Values
5.5.2 Array Attributes
5.5.3 Parenthetical Expressions
5.5.4 Positive Forms of Logic
5.5.5 Short Circuit Forms of the Logical Operators
5.5.6 Accuracy of Operations With Real Operands
5.6 Statements
5.6.1 Nesting
5.6.2 Slices
5.6.3 Case Statements
5.6.4 Loops
5.6.5 Exit Statements
5.6.6 Recursion and Iteration Bounds
5.6.7 Goto Statements
5.6.8 Return Statements
5.6.9 Blocks
5.6.10 Aggregates
5.7 Visibility
5.7.1 The Use Clause
5.7.2 The Renames Clause
5.7.3 Overloaded Subprograms
5.7.4 Overloaded Operators
5.7.5 Overloading the Equality Operator
5.8 Using Exceptions
5.8.1 Handling Versus Avoiding Exceptions
5.8.2 Handlers for others
5.8.3 Propagation
5.8.4 Localizing the Cause of an Exception
5.9 Erroneous Execution
5.9.1 Unchecked Conversion
5.9.2 Unchecked Deallocation
5.9.3 Dependence on Parameter Passing Mechanism
5.9.4 Multiple Address Clauses
5.9.5 Suppression of Exception Check
5.9.6 Initialization
5.9.7 Direct_IO and Sequential_IO
5.9.8 Incorrect Order Dependencies
5.10 Summary
CHAPTER 6: Concurrency
6.1 Tasking
6.1.1 Tasks
6.1.2 Anonymous Task Types
6.1.3 Dynamic Tasks
6.1.4 Priorities
6.1.5 Delay Statements
6.2 Communication
6.2.1 Efficient Task Communications
6.2.2 Defensive Task Communication
6.2.3 Attributes 'Count, 'Callable and 'Terminated
6.2.4 Shared Variables
6.2.5 Tentative Rendezvous Constructs
6.2.6 Communication Complexity
6.3 Termination
6.3.1 Avoiding Termination
6.3.2 Normal Termination
6.3.3 The Abort Statement
6.3.4 Abnormal Termination
6.4 Summary
CHAPTER 7: Portability
7.1 Fundamentals
7.1.1 Global Assumptions
7.1.2 Actual Limits
7.1.3 Comments
7.1.4 Main Subprogram
7.1.5 Encapsulating Implementation Dependencies
7.1.6 Implementation-Added Features
7.2 Numeric Types and Expressions
7.2.1 Predefined Numeric Types
7.2.2 Ada Model
7.2.3 Analysis
7.2.4 Accuracy Constraints
7.2.5 Comments
7.2.6 Precision of Constants
7.2.7 Subexpression Evaluation
7.2.8 Relational Tests
7.3 Storage Control
7.3.1 Representation Clause
7.4 Tasking
7.4.1 Task Activation Order
7.4.2 Delay Statements
7.4.3 Package Calendar, Type Duration, and System.Tick
7.4.4 Select Statement Evaluation Order
7.4.5 Task Scheduling Algorithm
7.4.6 Abort
7.4.7 Shared Variables and Pragma Shared
7.5 Exceptions
7.5.1 Predefined Exceptions
7.5.2 Constraint_Error and Numeric_Error
7.5.3 Implementation-Defined Exceptions
7.6 Representation Clauses And Implementation-Dependent Features
7.6.1 Representation Clauses
7.6.2 Package System
7.6.3 Machine Code Inserts
7.6.4 Interfacing Foreign Languages
7.6.5 Implementation-Defined Pragmas and Attributes
7.6.6 Unchecked Deallocation
7.6.7 Unchecked Conversion
7.6.8 Run Time Dependencies
7.7 Input/Output
7.7.1 Name and Form Parameters
7.7.2 File Closing
7.7.3 I/O on Access Types
7.7.4 Package Low_Level_IO
7.8 Summary
CHAPTER 8: Reusability
8.1 Understanding and Clarity
8.1.1 Application-Independent Naming
8.1.2 Abbreviations
8.1.3 Generic Formal Parameters
8.2 Robustness
8.2.1 Named Numbers
8.2.2 Unconstrained Arrays
8.2.3 Assumptions
8.2.4 Subtypes in Generic Specifications
8.2.5 Overloading in Generic Units
8.2.6 Hidden Tasks
8.2.7 Exceptions
8.3 Adaptability
8.3.1 Complete Functionality
8.3.2 Generic Units
8.3.3 Using Generic Units to Encapsulate Algorithms
8.3.4 Using Generic Units for Abstract Data Types
8.3.5 Iterators
8.3.6 Private and Limited Private Types
8.4 Independence
8.4.1 Using Generic Parameters to Reduce Coupling
8.4.2 Coupling Due to Pragmas
8.4.3 Part Families
8.4.4 Conditional Compilation
8.4.5 Table-Driven Programming
8.5 Summary
CHAPTER 9: Performance
9.1 Improving Execution Speed
9.1.1 Pragma Inline
9.1.2 Blocks
9.1.3 Arrays
9.1.4 Mod and Rem Operators
9.1.5 Constraint Checking
9.2 Summary
CHAPTER 10: Complete Examples
10.1 Menu-Driven User Interface
10.2 Line-Oriented Portable Dining Philosophers Example
10.3 Window-Oriented Portable Dining Philosophers Example
APPENDIX A: Map from Ada Language Reference Manual to Guidelines
REFERENCES
BIBLIOGRAPHY
INDEX