Consider the input/output libraries we have been using in this book. Each of
the various Get
and Put
statements in the earlier
examples is really a procedure call statement. A procedure is a kind of
system building block, a way of putting together a group of program statements
and treating them as a unit, causing them to be executed by means of
procedure calls. In this book you will learn how to write procedures; in
this chapter you will continue just to use procedures written by others.
The Get
and Put
procedures we have been using were
written by another programmer at another time; they were supplied to us as part
of a package called Ada.Text_IO
. Just as a procedure is a
way of grouping statements, a package is a way of grouping procedures (and
other program entities we will introduce later on). It is through the use of
packages that procedures can be written and tested for general use (that is, by
other programmers) and put in a form in which they can be supplied to others.
Ada compilers come with several standard library packages.
Ada.Text_IO
is one of these; in the next section you will see
another, called Ada.Calendar
.
The package concept is one of the most important developments to be found in modern programming languages, such as Ada, Modula-2, Turbo Pascal, C++, and Eiffel. The designers of the different languages have not agreed on what terms to use for this concept: Package, module, unit, and class are commonly used. But it is generally agreed that the package--as it is called in Ada--is the essential programming tool to be used for going beyond the programming of very simple class exercises to what is generally called software engineering, or building real programs of real size for the real world. It is the package that allows us to develop a set of related operations and other entities, especially types, to test these thoroughly, and then to store them in an Ada program library for our future use or even to distribute them to others.
You will work with three kinds of packages in this book:
Ada.Text_IO
and
Ada.Numerics
, which you have seen already, and
Ada.Calendar
, introduced in Section 3.6--which are required by
the Ada standard and supplied with all compilers;
Copyright © 1996 by Addison-Wesley Publishing Company, Inc.