Report on the applicability of an OODBMS for Dreamhome

advertisement
Report on the applicability of an OODBMS for
Dreamhome
Assignment Number: CO3701 Assignment 1
Hand In Date:
16/12/8
Name: Eugen MOSHAMMER
Lecturer: Thomas Stütz
Course: CO3701
Table of contents
1.
Introduction.................................................................................................................................... 3
2.
Object Oriented Database Management System (OODBMS) ........................................................ 3
3.
Comparison of RDBMS with OODBMS ........................................................................................... 6
3.1.
Related concepts.................................................................................................................... 6
3.2.
Advantages and Disadvantages of OODBMS and RDBMS ..................................................... 7
4.
Aspect of Hibernate with RDBMS................................................................................................... 9
5.
Problem areas implementing an OODBMS within the organization............................................ 10
6.
Conclusion .................................................................................................................................... 10
7.
References .................................................................................................................................... 11
7.1.
Figures.................................................................................................................................. 11
1. Introduction
With the growing of Dreamhome company the administrative work also grows and now the company
has a dimension that more and more administrative staff is being employed to manage the
increasing paperwork. Another factor is, that the communication and information exchange between
the offices are very low and so they need a shared location to store their data. So every office wants
to store and retrieve the data of the whole company. In modern applications usually objects are used
to represent data and there are different ways to persist the objects. Persistence implies a “process
of how to store the objects” (Ambler, 1998) and for this process there are three main mechanisms:
1. Object Oriented Database Management Systems (OODBMS),
2. Relational Database Management Systems (RDBMS) and
3. Object-Relational Database Management Systems (ORDBMS).
Well, another way to persist the objects is to write the object representation into a file but in praxis
this mechanism of storing the data is never used nowadays. It is a standard situation for today’s
applications that keep their data on a server in a database that they have to store some data at the
same time as they get requests from multiple clients to show some data from the database.
(Obasanjo, 2001)
The goal of this assignment is to answer the following questions:
What is an Object Oriented Database Management System in general?
Is an Object Oriented Database Management System a real alternative to a Relation Database
Management System?
What are the advantages of using an Object Oriented Database Management System instead of a
Relational Database Management System in general and especially for Dreamhome company?
2. Object Oriented Database Management System (OODBMS)
At this point I will start with a definition what is an Object Oriented Database Management System:
(Cattell et al, 2001) define “an ODBMS to be a DBMS that integrates database capabilities with
object-oriented programming language capabilities” which means that an OODBMS is a combination
of the capabilities of an object oriented programming language and the principals of a database
management system. It includes the features of OO-programming like polymorphism, inheritance
and encapsulation as well as the database properties like atomicity, consistency, isolation and
durability (ACID). In such an ODBMS the object attributes and object methods are stored in the
database. (Dogac et al, 1994)
The Object Oriented Database Manifesto lists the following specifics for a system to support before it
can be called an OODBMS:
1. “Complex objects
2. Object identity
3. Encapsulation
4. Types and Classes
5. Class or Type Hierarchies
6. Overriding, overloading and late binding
7. Computational completeness
8. Extensibility
9. Persistence
10. Secondary storage management
11. Concurrency
12. Recovery
13. Ad Hoc Query Facility” (Atkinson, 1989, pp. 223-240)
A persistent object should belong to a class and can have one or more types and attributes. Each
object has an explicit object identifier (OID). OIDs are permanent, not based on any data of the
object or the object class and generated by the system, so it is secured that no object can have the
same object identifier like another object. The Object identification is the reason why persisting
object references are possible. This mechanism makes it easy to store objects to the database with
all their reference objects at the same time. But the other side of the coin is that it could be the
reason for referential integrity problems if an object is deleted while other objects still have
references to the first one. Figure 1 shows on the one hand how the objects are stored in the object
oriented database and on the other hand, how the objects are represented in the application cache.
figure 1: Example for object structure in application and OODBMS
One of the primary features of an Object Oriented Database Management System is that there is no
difference in the access to the objects if they are stored in the database or in the memory. This fact is
a significant difference to RDBMS because in OODBMS there is no need to interact via a sub language
like SQL and there is also no reason to use a Call Level Interface like ODBC, ADO or JDBC.
There are two ways of accessing to an object from the database. If a client do a request to an object
from the database it will be loaded to the application’s cache where it can be used as a transient
value without connection to the representation of the object in the database. It also can be a mirror
to the stored objects and in this case the changes will be reflected to the database objects and
changes of the database objects will be refetched from the OODBMS.
3. Comparison of RDBMS with OODBMS
Choosing between these options need to have a closer look at some different aspects. The main
keywords are development, performance and access to different sources (it’s possible that more
than one application needs the same data source). The last one is a necessary point for Dreamhome
company, because all the different offices can have different applications and need the data from the
same database.
The performance of the Database it concerned on the structure of the data. An application that
navigates though the data like following links will be more efficient if it uses an Object oriented DB. If
you have to process the data sequentially or have a complex query to get the data the relational DB
is faster. So in fact the data structure of the Dreamhome company will not be extremely complex
because in the shared database there will be some information about the owner, the clients, the
properties they want to rent, the furniture and the services the owners and clients want to occupy.
(Zyl, 2006)
Another possibility is a combination of the two solutions but some experts belief that these objectrelational tools add translation overhead at each operation to the database and so this combination
is slower than each single solution on its own. (Zyl, 2006) (Hibernate is a example for such an objectrelational tool, but there will be more information about this issue in an own paragraph in this paper)
So it is possible that to develop with a more powerful OO domain modeling technique, “whose
constructs are then translated to relational equivalents by the tool”. (Zyl, 2006)
Related concepts
Some basic concepts of the relational database model are much related to those of object oriented
database model. A class in the OODBMS is analog to the relation or table of an RDBMS. An instance
of a class is similar to a tuple in the relational database with the difference that a class has attributes
and behaviors. A class attribute is similar to a column in a tuple except that a class attribute can hold
data of many types and a column can hold only primitive data types. The last point is that classes
have methods that are complete; relational databases normally do not have complete programming
capabilities. Stored procedural languages come close to those programming features. (Obasanjo,
2001)
Indexes, deadlock detection, backup and restoration are features that are normal day-to-day
business for a relational database management system but these mechanisms also exist in the
OODBMS. In the following part there is a list and a description of advantages and disadvantages of
Object Oriented Database Management Systems partly compared with relational database
management systems. (Obasanjo, 2001)
3.2. Advantages and Disadvantages of OODBMS and RDBMS
Most OODBMSes have implemented a reachability persistence which is a big advantage at complex
data relationship especially complex object relationship (e.g. networked data structure). Reachability
persistence means that if an object is stored to the database, the object references the first one is
also stored. (If Object A references Object B, and Object A is persistent, Object B is also persistent)
(Edlich, Paterson et al, 2006)
The depth of the reachability persistence can be specified by the programmer, so whole bundles of
objects can be fetched with a single call. The details like references between the stored objects are
handled by the Management system. Such object structures can be found at a tree with parent, child,
grandchild and so on. In this situation there is no need to change the original structure of the data to
a model. Programmers only have to specify the depth of the persistence and so they can control if
the whole tree is fetched and stored or only a few branches with children. There is also no problem
to store an object which contains a collection of other objects of different types. Most of the
ODBMSes treat the collection just like another object and allow fetching and storing the parent
object with all the members in it with a single call. But not only the relationship of the data can be
very complex, also the data itself can have a very complex structure. It is not unusual that you have a
big class which holds a number of medium-sized classes which themselves holds a lot of small-sized
classes. In a relational database model either you have a big table with many null entries or you have
many small tables which are linked with foreign keys. The problem is if you have very many small
tables and you need the data from all of it you always have to do a join over the tables which costs
lot of time in some cases. (Grehan, 2005a)
The data has usually a hierarchical form while modeling a real world problem. This is also the
situation in Dreamhome company. For instance the supervisor and assistant situation can be build
much easier in an OODBMS than in a RDBMS. In an RDBMS you either have a field that identifies the
supervisor or you have a second table with a foreign key to identify the relationship between
supervisor and assistant. In an OODBMS you simply have a class Assistant which is parent class of the
class Supervisor. Inheritance is a standard feature which supports every object oriented
programming language and allows that a child object inherits the behavior and attributes from the
parent object. So it is also supported by Object Oriented Database Management Systems which
means that if a class A is derived from a class B than all methods and attributes of class B can be used
everywhere where class A is used. (Obasanjo, 2001)
If there are some classes whose members are collections (e.g. a List or a Set) this represents a one to
many relationship in a RDBMS. So there is a need of two tables. One for the first object and a second
one which stores the collection defined in the parent object. This technique implies a work overhead.
This situation is much more difficult if the parent object contains different types of objects. Hibernate
is a solution for this problem. (Grehan, 2005a)
Another feature of object oriented languages and databases is polymorthism. “In simple terms,
polymorphism is the ability of one type, A, to appear as and be used like another type, B. In strongly
typed languages, this usually means that type A somehow derives from type B, or type A implements
an interface that represents type B.” (en.wikipedia.org, 22/11/8)
A change of the structure of data and objects on the fly is not a problem with an Object Oriented
Database Management System. The longer one application lives the higher is the probability that
some changes of the data / object structure are necessary. If the situation occurs that a field have to
be added to the structure, the Mangement system handles it to add the field to the old objects which
are already stored and fills it with default values like null or zero. If a field has to be removed from
the object the OODBMS loads the whole object and skip the fields which are not available any more.
This is a big disadvantage in an RDBMS because if some data members or relationship between
objects change there is also a change of the schema and query code needed and the update of the
old data is very work intensive. (Grehan, 2005a)
Dreamhome company have several offices around the world. Resultant on this fact there are many
applications using the same database and the access to the data are the same from each application
in an OODBMS because objects being fetched, stored and manipulated in the same way. And a
change of the class structure is one change of a single library. Most applications are using object
oriented programming techniques and if a relational Database Management System is in use there
have to be a translation from the object model to the relational model. So, in Dreamhome company
each application has a schema / mapping code, and if there is a change of structure of the database,
all applications have to be searched through and changed. (Papazoglou, 2000)
But an ODBMS is not always the better way to store data. There are also some disadvantages of
Object Oriented Database Management Systems. The extraction of the data, for instance for some
reports, are very complicated because Object databases generally hide their contents behind object
oriented programming environments, so special tools have to be used to extract the data. (Zyl, 2006)
The next point is that normally there is a language dependency in OODBMSes. This means that the
database is usually linked to a specific language and the data in the system are only accessible from
this language using a specific Application Programming Interface (API). (Obasanjo, 2001)
There is one more point which has to be note as a disadvantage of OODBMS: the lost of flexibility. In
relational database systems it is no problem to do ad hoc queries. In such queries it is the possibility
exists to create new tables by joining already existing tables. But it is not possible to “join” two
classes in an OODBMS. An Object Oriented Database Management system highly depends on the
design of the system. (Obasanjo, 2001)
A Relational Database Management System, named in some points before, is an alternative to the
OODBMS.
“Relational databases store data in tables that are two dimensional. The tables have rows and
columns. Relational database tables are "normalized" so data is not repeated more often than
necessary. All table columns depend on a primary key (a unique value in the column) to identify the
column. Once the specific column is identified, data from one or more rows associated with that
column may be obtained or changed.” (www.comptechdoc.org, accessed 23/11/8)
The issue of complex data relationship, before named as an advantage in OODBM Systems, is a
disadvantage of RDBMS. In situations where a deep object structure is given like a tree with many
twigs and leafs it is a very time intensive and difficult exercise to translate the highly connected
object structure to a form which can be fit into a relational database. (Grehan, 2005a) On the one
hand it is very difficult to wrap the data to the relational tables and on the other hand the original
structure is lost. So there is a large section of code needed to wrap the data in the transactions and
to safeguard the data relation. Another point is that this overhead impedes performance in multiuser
applications. The above named fact is only for the sake of completeness. For the Dreamhome
company this point doesn’t have much relevance because there is no really high complex object
structure given.
But there are also some points which argue for a Relational Database Management System. It is a
fact that the efficiency of a RDBMS is higher when the data and the relationship between the data
are simple. Another fact is that the Standards for RDBMS are more stable than for an ODBMS and
there are much more user tools available for RDBMS.
4. Aspect of Hibernate with RDBMS
Another possibility which have to be note is a combination of a relational database system with an
object relational mapping tool like Hibernate.
“Hibernate is an object-relational mapping (ORM) library for the Java language, providing a
framework for mapping an object-oriented domain model to a traditional relational database.
Hibernate solves Object-Relational impedance mismatch problems by replacing direct persistencerelated database accesses with high-level object handling functions.” (en.wikipedia.org, accessed
23/11/8)
Hibernate is a middleware between the object oriented programming language and the relational
database system and covers the transformation from an object to the relational form which can be
stored into the database, also if the object contains a list or a set of other objects. (Bauer, King, 2004)
5. Problem areas implementing an OODBMS within the
organization
New applications have to be implemented, which can store and fetch the data into and from the
OODBMS which may include some extra costs for Dreamhome company. Another possibility is to
search for free standard tools which can handle the data exchange with the Object Oriented
Database Management System.
6. Conclusion
Nowadays most of the applications connected to a database use the relational standard but recently
the Object Oriented Database Management System becomes more important and it is expected that
many companies like Dreamhome research the advantages of OODBMS and implement this solution.
7. References
Rick Grehan, When to Use an ODBMS, 2005a
Rick Grehan, ODBMS for RDBMS users, 2005b
Pieter van Zyl, Derrick G. Kourie, Andrew Boake, Comparing the Performance of Object Databases
and ORM Tools, ESPRESSO Research Group Department of Computer Science
University of Pretoria, 2006
Stefan Edlich, Jim Paterson et al, The Definitive Guide to db4o, Chapter 3 – Comparing the Object
and Relational Data Models, Apress, 2006, ISBN 1-59059-656-0
Dare Obasanjo, An Exploration of Object Oriented Database Management Systems, 2001
(http://www.25hoursaday.com/WhyArentYouUsingAnOODBMS.html, accessed 10/11/8)
OODBMS Facts. Barry & Associates. 2001 (http://www.odbmsfacts.com/ accessed 28/10/8)
Atkinson M. et al., The Object-Oriented Database Manifesto. In Proceedings of the First International
Conference on Deductive and Object-Oriented Databases, pages 223-40, Kyoto, Japan, December
1989 ( http://www.cs.cmu.edu/People/clamen/OODBMS/Manifesto/htManifesto/Manifesto.html
accessed 30/10/8)
McFarland, Gregory, Andres Rudmik, and David Lange, Object-Oriented Database Management
Systems Revisited. 1999 (http://www.dacs.dtic.mil/techs/oodbms2/ accessed 1/11/8)
Object-oriented database articles and products
(http://www.service-architecture.com/object-oriented-databases/ accessed 16/11/8)
Basic principals of building object oriented databases (http://www.garret.ru/oodbms.html, accessed
4/11/8)
Papazoglou M.P., Spaccapietra S., Tari Z. (2000) Advances in Object-Oriented Data Modeling, MIT
Press
Dogac A., Ozsu T.M., Biliris A. (1994), Advances in Object-Oriented Database Systems, Turkey:
Birkhäuser (1994)
Bauer C., King G. (2004) Hibernate in Action. Practical Object/Relational Mapping, Manning
Hibernate (http://en.wikipedia.org/wiki/Hibernate_(Java) accessed 23/11/8)
Object Oriented Databases
(http://www.comptechdoc.org/independent/database/basicdb/dataobject.html accessed 23/11/8)
Polymorphism in object-oriented programming
(http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming accessed 22/11/8)
7.1. Figures
figure 1: Example for object structure in application and OODBMS: http://www.servicearchitecture.com/images/object-oriented_databases/object-database.jpg accessed on 2008-11-1
Download