5.1 Concepts and Motivation

[ Table of Contents ] Chapter Overview ] Next ] [ Glossary/Index ]

Object oriented methods have become very popular during the 1980's and 1990's. Some of the better known books on this technology are: [Wirfs-Brock90], [Rumbaugh91], [Coad&Yourdon91], [Jacobson92], [Booch94], and [Coleman94]. Recent attempts to "unify" notations and methods have featured the combined efforts of Grady Booch, Ivar Jacobson and James Rumbaugh. One result of this collaboration is the Unified Modeling Language (UML), summarized in [Fowler97].

Central Concepts of Object Technology

The elements of Ada covered in earlier chapters can be used to implement object oriented designs created in the spirit of the three concepts outlined above. In fact, Ada 83 has been used to do so, very successfully, for many years. (An Ada type would represent each class as the term is used above, ADT packages would be used to declare the types which serve as templates for the object instances needed, and an Ada derivation class might represent the "class hierarchy" mentioned above. The "specialization's" can be handled in various ways, depending on whether new operations or new data structure are needed.)

The techniques outlined and illustrated in the next several pages provide a more convenient way to create the class hierarchies and the specialization's. This involves the second form of derived types mentioned (but not illustrated) in an earlier chapter. The second form involves a language feature known as the tagged type (see next page).

Motivating Example

This UML class diagram depicts the inheritance relationships for a partial hierarchy of military vehicles. The root class (it will be "type" in Ada), Vehicle, has four attributes and four operations common to all descendants. The Aircraft sub-class adds a new attribute, Altitude, and an associated operation. The Submarine sub-class of the sub-class, Ship, adds a new attribute, Depth, and an associated operation. Note that the Aircraft and Ship classes override the operation, Change_Heading, introduced at the top level, and the four lowest-level classes override the operation, Deploy_Weapon, introduced at the top level.

Im5-2.gif (6183 bytes)

Note that each sub-class has an "is a" or "is a kind of"   relationship to its parent -- not an "is part of" or "is a component of" relationship. Thus, we have a situation where it is appropriate to consider the classification approach rather than the composition approach to OOD and OOP.

Note that the three highest-level classes are labeled as abstract -- meaning that there is no intention of ever declaring objects of these classes. The low-level classes are "concrete" and will serve as templates for actual objects. Similarly, two of the highest-level operations are labeled as abstract, and are "place holders" for actual operations defined at lower levels. The other two high-level operations, Rename_Reset and Report_Position, are defined at that level and can be used unmodified in all descendant classes.

The next section introduces a key language feature, the tagged type. The following sections introduce additional features and then provide a set of Ada packages that implement the inheritance hierarchy represented above.  Later pages provide example programs in which this set of packages is used.

Related Topics

2.1 Conceptual Models and OOP

[ Back to top of pageNext ]