| You
are here: Freetutes.com
> Systems
Analysis and Design
Object Oriented Model
Nowadays people are moving towards the object oriented approach in many fields.
These fields include programming, software engineering, development technologies,
implementation of databases, etc. Object oriented concepts have their roots in
the object oriented programming languages. Since programming languages were the
first to use these concepts in practical sense. When these concepts became widely
popular and accepted, other areas started to implement these ideas in them. It
became possible due to the fact the object-oriented concepts try to model things
as they are. So today it is a common practice to use object-oriented concepts
in data modeling. In this session we’ll try to look at the process of applying
object oriented concepts to data modeling.
Object Oriented data Modeling Concepts
As discussed earlier Object oriented model has adopted many features that were
developed for object oriented programming languages. These include objects, inheritance,
polymorphism, and encapsulation.
In object-oriented model main construct is an object. As in E-R model we have
entities and in relational model, there are relations similarly we have objects
in OO data modeling. So first thing that is done in OO model is to identify the
objects for the systems. Examining the problem statement can do it. Other important
task is to identify the various operations for these objects. It is easy to relate
the objects to the real world. In the section that follows we will try to understand
the basic concepts of OO data model.
Objects and object identity:
In this model, everything is modeled as objects. An object can be any physical
or abstract thing. It can be a person, place, thing, or a concept. An object can
be used to model the overall structure not just a part of it. Also the behavior
of the thing that is being modeled is also specified in the object. This feature
is called encapsulation. Encapsulation is discussed later in the chapter. Only
thing we need to know at this stage is object can store information and behavior
in the same entity i.e. an object. Suppose a car is being modeled using this method.
Then we can have an object ‘Car’ that has the following information.
Car:
Color, Brand, ModelNo, Gears, EngineCylinders, Capacity, No of gates. All this
information is sufficient to model any car.
All the objects should be unique. For this purpose, every object is given an
identity. Identity is the property of an object, which distinguishes it from all
other object. In OO databases, each object has a unique identity. This unique
identity is implemented via a unique, system generated object identifier (OID).
OID is used internally by the system to identify each object uniquely and to create
and manage inter-object references. But its value is not visible to the user.
The main properties of OID :
-
It is immutable: The value of OID for a particular object should not change.
This preserves the identity of the real world object being represented.
-
It is used only once: Even if an object is removed its OID is not assigned
to other objects.
The value of OID doesn’t depend upon any attributes of the object since
the values of attributes may change. OID should not be based on the physical address
of the object in memory since physical reorganization of the database could change
the OID. There should be some mechanism for generating OIDs.
Another feature of OO databases is that objects may have a complex structure.
It is due to contain all of the significant information that describes the object.
In contrast, in traditional database systems, information about a complex object
is often scattered over many relations or records. See fig. 8.12. It leads to
loss of direct correspondence between a real-world object and its database representation.
The internal structure of an object includes the specification of instance
variables, which hold the values, that defines the internal state of the object.
In OO databases, the values (or states) of complex objects may be constructed
from other objects. These objects may be represented as a triple t(i, c, v), where
i is a unique object identifier, c is a constructor (that is, an indication of
how the object value is constructed), and v is the object value (or state).
There can be several constructors, depending upon or the OO system. The basic
constructors are the atom, tuple, set, list, and array constructors. There is
also a domain D that contains all basic atomic values that are directly available
in the system. These include integers, real numbers, character strings, Boolean,
dates, and any other data types that the system supports directly.
An object value v is interpreted on the basis of the value of the constructor
c in the triple (i,c,v) that represents the object.
If c = atom, the value is an atomic value from domain D of basic values supported
by the system.
If c = set, the value v is a set of objects identifiers{i1,i2,……..,in),
which are the identifiers(OIDs) for a set of objects that are typically of the
same type.
If c= tuple, the value v is a tuple of the form <a1:i1,………….,
an:in), where each aj is an attribute name( sometimes called an instance variable
name in OO terminology) and each ij is an object identifier(OID).
If c = list, the value v is an ordered list of object identifiers[i1,i2,………..,
in] of the same type. For c = array, the value v, is an array of object identifier.
Consider the following example:
O1 = (i1, atom, Roger)
O2 = (i2, atom, Jane)
O3 = (i3, atom, Goerge)
O4 = (i4, set, {i1,i2,i3})
O5 = (i5, atom, SE)
O6 = (i6, atom, NEPZ)
O7 = (i7,tuple,<DNAME:i5,DNUMBER:i8,LOCATION:i6,ENAME:i3>)
O8 = (i8,atom,1)
Here value of object 4 is constructed from object values of objects O1, O2,
and O3. Similarly value of object 7 is constructed from the value of O1, O3, O6,
and O8. These constructors can be used to define the data structures for an OO
database schema.
See Also
<<
Previous Page | Contents
| Next Page
>>
|