Object Oriented Terms
All computer systems must possess the properties
of their architecture to be considered that kind of a computer system. For
example, a system must have tables to be considered a relational architecture.
An object-oriented database is no exception. An
object-oriented database must contain some basic object architecture
properties. However, in the real world many of these properties are under
debate, and some, such as multiple inheritance are viewed as enhancements to the
object model, rather than a part of the core foundation. For example in the
object-oriented language Smalltalk, multiple inheritance is not supported, even
though multiple inheritance is consider a part of the object architecture. The
following section explores the object-oriented terminology and explains the
basic precepts of the object model.
A class characterizes one or more objects that
have common methods, variables and relationships (figure 1.3). Here we see that
that ?Publisher? is the class and ?Jones Publishing? and ?Brown Publishing? are
objects within this class.
Classes are hierarchical in nature. This means
that a class can be broken down into other classes, and when this is done they
follow a hierarchical chart. In a class hierarchy, a ?derived? class is
called a subclass while the original class is called a superclass. A subclass
can also be decomposed where a subclass becomes a superclass for all classes
below it. On the other hand, a superclass is a combination of all of its?
subclasses. If you combine the sub-classes you would form a superclass as shown
in Figure 1-4. In figure 1-4 Vehicle is the superclass and automobile, boat,
and airplanes would be the subclasses.
Classes are the templates for objects. They
serve as the ?blueprint? to 'stamp-out? objects when they are created. A class
contains attributes (sometime called variables), and these attributes become a
part of the object when it is created. When defined in a class definition,
attributes describe the class; when and object is created, these descriptions
become variables. In addition to data definitions, classes also contain the
behaviors (sometimes called ?methods?) that can be applied to the variables
inside an object.
In figure 1-4 we see that VEHICLE has the
variables serial number, weight, cost and number of passengers. The class
AUTOMOBILE has the variables engine size and number of tires, The BOAT class
has the variables width and length, and AIRPLANE has the variables wingspan and
number of engines.
The methods for a class define the set of
operations that can be performed upon an object. For example, when a method is
applied to an object it will either return a value or the method will perform
some operation to update the values in an object. In figure 1-4 we see that a
method for VEHICLE might be used to compute the cost of the vehicle, returning
the dollar value of the vehicle. Sometimes methods do not return values. If a
method was designed to update the number of passengers for a vehicle, no value
would be returned but a data item inside the target object would change value.
Objects are the fundamental concept in an
object-oriented database. In essence, objects are an abstract representation of
real world things that are stored in an object-oriented database. An object is
an instance of a class, in the sense that it is stamped-out from the class
definition. The object contains all the values of the variables from the class
or classes. The methods are stored with the class definition, and the objects
know how to access the class definition so that they can be used to perform
their functions on the data in the object. Data in an object can only be
accessed by using one of the objects methods. When we say that an object is an
instance of a class, we mean that all objects of the same class contain the same
data items, but each data item may contains different values.
You can think of an object as a self contained
package that has three parts:
It's own private information (data
It's own private procedures that
will manipulate the objects data values. (via the class definition)
A public interface so that this
object can communicate with other objects.
An important point about objects is to remember
that objects don't do something, they are something. Objects are given a system
generated unique id called the Object IDentifier (OID) when they are created.
OID's are explained in chapter 2, but basically the OID that is assigned to an
object stays with the object for the life of the object and will never be
re-used, even after the object has been deleted. The OID is always unique and
no matter what object methods are applied to the values inside the object, the
OID will never change. One thing that an OID lets us do is distinguish between
two or more objects. Using the OID we can determine if two objects are equal,
that is, if two objects contain the same values. Object-oriented databases
allow you two have two or more objects with the same values unlike other
databases like a relational database that does not allow duplicate rows.