-*- Mode: Text; Fonts: Ct18b -*- 13.3 APPLICATIONS FOR ADA PACKAGES Ada is a general-purpose language with considerable power, but it still does not prevent a programmer from abusing certain features of the language -- it is definitely possible to write unreadable, unstructured Ada code. To avoid this trap, each language construct must be applied in a purposeful manner. This is clearly true for Ada packages, since they form an essential element of any software system. Ada packages should be logically small, that is, they should export only a single, small chunk. We recommend four different applications for Ada packages, namely: named collections of declarations groups of related program units abstract data types abstract state machines These applications are further characterized by the kinds of entities they usually export: Named collections of declarations Export objects and types. Do not export other program units. Groups of related program units Do not export objects and types. Export other program units. Abstract data types Export objects and types. Export other program units. Do not maintain state information in the body. Abstract state machines Export objects and types. Export other program units. Maintain state information in the body. Note that these represent the purest form of application: in practice, we may find hybrid versions. The following sections provide a discussion and examples of each of these general applications.