Program Unit Symbols
|A subprogram is a module that performs actions by executing statements. There are two forms: the procedure and the function.|
|A package is a module that contains or "packages together" related resources. It has two separate parts: a declaration and body.|
|A task is a unit of concurrency. Each task has its own "thread of execution" and also has separate parts: declaration and body.|
|A protected unit provides coordinated access to shared data and also has separate parts: declaration and body.|
In all of the symbols shown above the clear parts represent the unit declarations (which define interfaces to client units -- the "external" view) while the shaded parts represent the bodies (where implementation details are given -- the "internal" view). The small four-sided figures jutting out to the left in the symbols for the package, task and protected units represent the "visible part" of their declarations. (As we will see later, except in the case of subprograms there may be both visible and private parts to a declaration.)
The above symbols for subprogram, package and task are basically the same as symbols used by many Ada programmers for many years. They were made popular by Grady Booch in an early Ada text called "Software Engineering with Ada." [Booch83]
Generic units are templates, which form the basis for creating other units called generic instances via a process called generic instantiation. The dashed rectangles on top of the generic unit symbols represent the specification of formal generic parameters and actual generic parameters, respectively.
Tasks, task types, protected objects and protected types are discussed in a later chapter on concurrency and synchronization. In the remainder of this chapter and several subsequent chapters, all discussion and examples will be confined to "single thread" programs using only subprograms, packages and generic units.
The next page introduces several ways for "connecting" Ada program units, along with symbolic techniques for graphically representing such connections in architectural diagrams.
[ Back to top of page ]