Object Oriented Database and Ada 95

The intention of this section is to make the limitation in the application of the concept of an object data base to Ada 95 visible and to discuss some implementation strategies.

When we talk about objects in Ada 95 we are talking about data types, packages implementing operations on these data types and the actual storage of the data in memory. A typical example is shown below:

Example 1-1. An Ada 95 Class

package Location is 

   type Object is tagged private;

   procedure Set_Location( 
      This : in out Object; X : in Integer; Y : in Integer );


   type Object is tagged record 
         X, Y : Integer;
      end record;

end Location;

In the example above, a data type Location.Object is defined which permits the operation Set_Location. From the specification point of view the data type and the code belonging together. Since Ada 95 does not provide a class loader mechanism as for example Java, the code fragment which contains the method Set_Location has to be assumed as a statically linked part of the application. This means that we are not able to store the code of a class together with the Object Data which is specified by the type declaration. This in turn requires the together with the object data some version information about the creating class has to be stored along with the object data.

Object Persistency is quite easy established by means for the Write/Read Operation using Ada 95 streams. This approach has the big disadvantage, that no information about the structure of the object is added to the file. This structure is assumed by the application reading in the data from the stream. If for some reason, data fields have been added or deleted the reading application will fail to read in the data. This means that the stored format has to contain additional field information. Ada 95 provides no reflective methods this means these informations have to be taken from the Ada 95 source code either by some kind of implementation specific preprocessor or e.g. by means of an ASIS based tool.