[Ada Information Clearinghouse]

Ada '83 Quality and Style:

Guidelines for Professional Programmers

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

CHAPTER 5: Programming Practices

Software is always subject to change. The need for this change, euphemistically known as "maintenance" arises from a variety of sources. Errors need to be corrected as they are discovered. System functionality may need to be enhanced in planned or unplanned ways. Inevitably, the requirements change over the lifetime of the system, forcing continual system evolution. Often, these modifications are conducted long after the software was originally written, usually by someone other than the original author.

Easy and successful modification requires that the software be readable, understandable, and structured according to accepted practice. If a software component cannot be easily understood by a programmer who is familiar with its intended function, that software component is not maintainable. Techniques that make code readable and comprehensible enhance its maintainability. Previous chapters presented techniques such as consistent use of naming conventions, clear and well-organized commentary, and proper modularization. This chapter presents consistent and logical use of language features.

Correctness is one aspect of reliability. While style guidelines cannot enforce the use of correct algorithms, they can suggest the use of techniques and language features known to reduce the number or likelihood of failures. Such techniques include program construction methods that reduce the likelihood of errors or that improve program predictability by defining behavior in the presence of errors.

In this chapter...

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

Summary
optional parts of the syntax
parameter lists
types
data structures
expressions
statements
visibility
using exceptions
erroneous execution

Back to document index