Introduction to ODL

Introduction to ODL

ODL (Object Definition Language) is a standardized language for specifying the structure of databases in object-oriented terms. It is an extension of IDL (Interface Description Language), a component of CORBA (Common Object Request Broker Architecture). The latter is a standard for distributed, object-oriented computing.

Object-Oriented Design

In an object-oriented design, the world to be modeled is thought of as composed of objects, which are observable entities of some kind. For instance, people may be thought of as objects; so may bank accounts, airline flights, courses at a college, buildings, and so on. Objects are supposed to have a unique object identity (OID) that differentiates them from any other object, as we discussed in "Object Identity".

To organize information, we generally want to group objects into classes of objects with alike properties. However, when speaking of ODL object-oriented designs, we should think of "similar properties" of the objects in a class in two different ways:

●  The real-world ideas represented by the objects of a class should be alike. For example, it makes sense to group all customers of a bank into one class and all accounts at the bank into another class. It would not make sense to group customers and accounts together in one class, because they have little or nothing in common and play basically different roles in the world of banking.

An object representing an account

●  The properties of objects in a class must be the same. When programming in an object-oriented language, we sometimes think of objects as records, like that suggested by Figure (a). Objects have fields or slots in which values are placed. These values may be of general types such as integers, strings, or arrays, or they may be references to other objects.

When specifying the design of ODL classes, we explain properties of three kinds;

1. Attributes, which are values associated with the object. We discuss the legal types of ODL attributes in "Types in ODL".

2. Relationships, which are connections between the object at hand and another object or objects.

3. Methods, which are functions that may be applied to objects of the class.

Attributes, relationships, and methods are collectively referred to as properties.

Class Declarations

A declaration of a class in ODL, in its simplest form, consists of:

1. The keyword class,
2. The name of the class, and
3. A bracketed list of properties of the class. These properties can be attributes, relationships, or methods, mixed in any order.

That is, the simple form of a class declaration is

class <name> {
<list of properties>