[Ada Information Clearinghouse]
Ada '83 Rationale, Sec 10.3: Methodological Impact of Separate Compilation

"Rationale for the Design of the
Ada® Programming Language"

[Ada '83 Rationale, HTML Version]

Copyright ©1986 owned by the United States Government. All rights reserved.
Direct inquiries to the Ada Information Clearinghouse at adainfo@sw-eng.falls-church.va.us.

CHAPTER 10: Separate Compilation and Libraries

10.3 Methodological Impact of Separate Compilation

The ability to compile separately a package specification and the corresponding package body has important methodological consequences for program development and maintenance. For example, it allows a team of programmers to agree upon a common interface and to define it by one or more package specifications. This being done, the package bodies, and any other unit that uses the common interface, can be developed in parallel and compiled in an arbitrary order.

A package specification contains all the declarations that need to be seen by any unit that uses the services of the package. The corresponding package body may be modified and recompiled without the need for recompilation of the units that use the services of the package. As long as the operations promised by the visible part are correctly achieved, the user will not be affected by changes to the package body. Another version of the package body, using a different technique, may be substituted without affecting the user.

This ability to compile a package specification and the corresponding package body separately is an extension of the idea of encapsulation. Since users are not affected by the contents of the package body - provided it is correct - there is no need to show them the source text of the package body: all they need is the corresponding object code.

Separate compilation of package bodies may thus be used to achieve physical hiding. This will be useful for confidentiality purposes. It will also help to prevent users from reading the algorithms and inferring implicit properties and making assumptions that might not be satisfied by later implementations. In this sense, separately compiled package bodies provide good support for the policy of restricted flow of information advocated by Parnas [PA 71].

Address any questions or comments to adainfo@sw-eng.falls-church.va.us.