Section 15.1 - Ada Program Structure

Because this is a tutorial I've used very short programs to demonstrate specific points. Real Ada programs are developed instead as a set of (many) Ada packages. Each package has a declaration that publicly declares the facilities it makes available, and each package has a body to implement that public declaration.

Packages are the principle structuring facility in Ada. Packages are intended to be used to directly support abstraction, information hiding, and modularization. For example, packages are useful for encapsulating machine dependencies.

It isn't easy to describe program structuring issues, because that's really a program design question, not just a language question. Some recommendations are given in Chapter 4 ("Program Structure") of Ada Quality and Style: Guidelines for Professional Programmers. Here are some of those guidelines:

Note that Ada is different from some other languages. Ada separates the concept of type from the concept of module (package); some other languages merge the two concepts (particularly Eiffel, and to a lessor degree C++). Each approach has its advantages and disadvantages, which we won't delve into here.


There is no quiz question for this section.

You may go to the next section.


You may also:

PREVIOUS Go back to the previous section

OUTLINE  Go up to the outline of lesson 15

David A. Wheeler (wheeler@ida.org)