CO3701 Advanced Database Systems (2008

advertisement
CO3701 Advanced Database Systems
(2008-09)
Report on applicability of OODBMS for an organisation.
By Gerald Sigmund
Contents:
1 Abstract
2 DreamHome
3 OODBMS
3.1 Databases
3.2 Features
3.3 Advantages
3.4 Disadvantages
4 RDBMS
4.1 Databases
4.2 Features
4.3 Advantages
4.4 Disadvantages
5 Conclusion
6 References
1 Abstract
This paper gives a short introduction into the Dream Home scenario. After that it
lists the main features, advantages and disadvantages of OODBMS and RDBMS.
Last but not least in the conclusion section a discussion will identify if a OODBMS
system is better than a RDBMS system for this scenario.
2 DreamHome
DreamHome is a company that offers properties for rent. The company has a lot of
branches where a different count of staff is working. A staff can be a manager, a
supervisor or an assistant. Clients can register them self at DreamHome to offer
their property.. DreamHome provides services like advertisement to ensure that a
property will gain a maximum return.
3 OODBMS
3.1 Databases
This section will list some of the available OODBMS database systems.
3.1.1
Db4objects
db4objects is a open source database that is available for Java and .Net. It
allows storing complex objects and hierarchies of these objects. It is easy to
use, flexible and has a high performance (db4objects).
3.1.2
Objectivity
Objectivity is a commercial database system. It can be accessed using Java,
C++, Python, Smalltalk and ODBC. It can be used on a lot of operating
systems namely Windows, Linux and Unix. Since the client doesn't have to
know where the data will be stored this system is very scalable (objectivity).
3.1.3
Progress Object Store
Progress Object Store is also a commercial database system. This system
can easy used with Java or C++ and has a high performance since it allows
to store object relations directly (Progress Object Store)
3.1.4
Versant ObjectDatabase
Versant ObjectDatabase is a high performance Java and C++ database
system. Versant it self describes the performance 10 times faster than on a
common RDBMS system (versant ObjectDatabase).
3.2 Features
The main features an OODBMS system should have are described by (Atkinson
et al, p 3 – 11). This section will list some of the features and gives a short
description for every point.
Complex Objects:
Complex objects are constructed from simple object types like integers, floats,
booleans, etc. Objects can also contain types like tupels, vectors, arrays, etc.
OODBMS must be able to operate on such complex objects. If an operation is
done on a complex object it must be propagated to down the object hierarchy
(Atkinson et al, p 4).
Object Identity:
Object identity has to be independent of the values the object consist of
(Atkinson et al, p 4). So it will be possible to store objects with the same values
into the database and each of the objects will get another identity number.
Encapsulation:
It should be possible to store in an object the logical part and the data. This can
be used for example if there is an object called Employee that has some data
like name, salary, address, etc and now gets functions like compute salary or
increase salary (Atkinson et al, p 7).
Class of Type Hierarchies:
Since inheritance is a powerful feature in object orientated programming a
OODBMS should also support these feature. So it will be possible to have a
table Person where a Student and Lecturer can be inherit from (Atkinson et al, p
7).
Overriding, overloading and late binding:
In an object orientated programming language it is possible to have a function
with the same name doing something different for derived classes. This allows
for example to implement a base class that has a draw function. Each derived
class can override this function and to a special version of this function. Since an
OODBMS system supports complex objects and inheritance this feature also
must be available (Atkinson et al, p 9).
Extensibility:
It should be possible to use user defined data types as well as that ones that
come with the database system. The support for both type classes should be
invisible for the user (Atkinson et al, p 10).
Persistence:
Persistence is one of the key features of a database. For a OODBMS is should
be possible to store objects independently of the data types it consists of
(Atkinson et al, p 10).
Ad Hoc Query Facility:
It should be possible to use a high level, fast and application independent query
language (Atkinson et al, p 11).
3.3 Advantages
Since OODBMS support storing of complex and type independent objects it is
possible to higher the amount of information that can be stored in such a
database. With OODBMS it is also possible to use versioning of the data. This
allows the to switch back to an older version of the data (Manion).
With OODBMS the developer doesn’t need to write a mapping layer for the data.
In a traditional relational database the developer has to write such layers to fill
the data in to user defined objects. This reduces developing time because there
is no need to write such a mapping layer (Versant).
Also a big advantage of such is system is simplicity. An OODMBS supports
storing of type and class independent objects which reduces development time.
Another advantage is that it is easy to implement new features and change the
members and functions of a class. This is possible because the objects will
directly be stored into the database and no table changes need to be done
(Coetzee et al, 2003, p 5).
With an OODBMS it is possible to store real world data (Object Orientated
Databases (b), p 11). An RDBMS always has to store keys and indexes into the
database. This is not needed in an OODBMS because every object has an
unique identity number (Atkinson et al, p 4).
There is no need of primary or foreign keys. An OODBMS stores an internal ID
for each object automatically. Therefore a developer doesn't need to take the
thematic of keys into account.
3.4 Disadvantages
(Object Orientated Databases (a), p 34) and (Object Orientated Databases (b), p
21) list the following disadvantage. There is no ad-hoc query language. It is
possible to create complex queries on the object tree but there is no standard
query language like SQL.
(Overview RDBMS-ORDBMS-OODBMS, p 10) also identifies two
disadvantages. There is no support for views and there is also only a small
support for security.
(Koetzee et al 2003, p 7) illustrates that there are several problems with schema
changes. Every schema change produces the change of classes and the project
needs to be recompiled. Also all the instances in the database need to be
updated.
Another disadvantage of such a database system is the lack of tools. Common
RDBMS have tools like report writers, data summary tools and data
aggregators. For an OODBMS such tools have to be written by the developer.
This is because there is no standard query language and no standard data
model system (Koetzee et al 2003, p 8). Writing such tools is not a complex task
since all the classes to access the database still exists in a project but it takes
time and this time will increase the development time.
The advantages that there are no private or foreign keys available can also be a
disadvantage. It is possible to store objects with the same data into the
database. Each of these objects will get a unique object id. If the data will be
selected the query returns two objects with the same data. This increases the
amount of redundant data into the database. Additional programming needs to
be done do forbid such situations.
Relations will be modeled using references. For example if there is an object
Lecturer that relates to Courses then the Lecturer can store a list of Courses. In
a RDBMS this will be modeled as 1 to * relation. Since an OODBMS stores
relations using references the developer has to take some pointer concepts into
account.
Also a big problem of such systems is that there is no standard data model. It is
not possible to read the data from an external program which doesn't know the
classes. In an RDMBS the data can be selected using SQL from any SQL tool.
4 RDBMS
4.1 Databases
4.1.1
Oracle
Oracle is a commercial database system. It is access able throw Java, C++,
.Net, etc and is optimized for a high amount of data. There also exists a free
version of the database that is only limited in the amount of data but not in
functions.
4.1.2
Microsoft SQL Server
Microsoft SQL Server is a database system for commercial and noncommercial use. It can be accessed using c++, .Net, etc. Like Oracle it is
also suitable for a high amount of data.
4.1.3
PostgreSQL
PostgreSQL is an open source database management system. It can be
accessed using nearly every programming language and has a high
performance.
4.2 Features
There are a lot of RDBMS available on the market but most of them support the
following features.
SQL:
SQL is a standardized query language to access the data of different tables and
views.
Views:
Views can be used to show different roles a different part of a table or multiple
tables. For example if a person from the marketing department only wants to see
5 rows of a table a view can be created to achieve this (Views).
Key, Index:
With keys it is possible to model relations. A primary key also prevents
duplicated data to be stored into the database. Indexes can be used to higher
the performance when retrieving data. For example a key can be created for
fields of the table that are often queried.
Triggers, Stored Procedures:
With common RDBMS it is possible to create triggers. Triggers are functions that
can be called for example when a table will be updated or data will be inserted.
Triggers can check the inserted data or write log entries into different tables.
Stored procedures are also functions but they can be used from the user for
example into a select statement.
Tables:
In a RDBMS data will be stored into tables. Tables can have fields with different
data types. These data types are depending on the RDBMS but all of them
support primitive types like integer, float and string. Also many RDBMS can store
BLOB's and CLOB's which can be used to store binary data.
O/R Mapper:
With RDBMS it is also possible to use the advantages of OODBMS. O/R
mapper like Hibernate allows the usage of inheritance, association,
polymorphism, composition and collections. It has a powerful query language
and doesn't hide the power of SQL (Hibernate).
Objects:
Some RDBMS like oracle allows to use object types of real world objects. It is
possible to create objects with attributes and functions. Such attributes can be
modeled using built in types or other objects. Functions will be represented
using stored procedures (Oracle9i Data Cartridge Developer's Guide).
4.3 Advantages
One big advantage of RDBMS is SQL. It is possible to use table joins and to
specify in detail which data should be retrieved.
RDBMS are fast in retrieving object since indexes are supported to speed up the
search for queried data.
With O/R mapper such as hibernate it is possible to use all the features of
OODBMS. Such ORDBMS allow high performance and storing complex data.
Such a system combines the advantages of RDBMS and OODBMS.
In a RDBMS it is possible to create the database schema and database itself
without programming any line of Java, C++ or any other programming language.
It is also possible to insert, update or delete data without programming work.
Another advantage is the use of security. It is possible to create different roles
that have different rights for different tables. For example an administrator can
delete, update and insert data. A user instead can only read and insert data into
the database.
4.4 Disadvantages
To access the data that will be stored in the database using a program the
developer has to create a layer in the application that maps the data stored in
the database. Classes and functions need be written and that costs
development time.
RDBMS needs more administration investment. The administrator has to define
roles, create tables or change the schema of the database. In an OODBMS the
developer only has to create classes and store them into the database.
5 Conclusion
Some of the requirements of the DreamHome company can easily implemented
using a OORDMS. For example the different stuff types like manager, supervisor
and assistant can be derived from a base class Person.
Clients will get weekly reports of the properties he offers for rent. In RDBMS it is
possible to create automatic reports. These reports can be sent directly to client.
The biggest problem using OODBMS for this project is that there are no views
required. Views can be used to display the data of a property for different roles. For
example the client can see other data than a person who wants rent a property.
When using an OODBMS every time the whole data needs to be retrieved from the
database and only some values will be displayed.
Also the administration will be easier using a RDBMS system. A database
administrator can create the different roles, tables, views, triggers, etc. For an
OORDBMS all of that work hast to be done by a developer since the database
scheme is a collection of the classes in the code.
A combination of RDBMS and O/R mapper like hibernate allows combining the
advantages of polymorphism and inheritance with the speed and security features
of a RDBMS.
For the DreamHome project such a solution should be used to be flexible and gain
a high performance.
6 References
db4objects
http://www.db4o.com
(accessed 14.12.2008)
Objectivity
http://www.objectivity.com/
(accessed 14.12.2008)
Progress Object Store
http://www.progress.com
(accessed 14.12.2008)
Verstant ObjectDatabase
http://www.versant.com
(accessed 14.12.2008)
Malcolm Atkinson, David Dewitt, Klaus Dittrich, David Maier, Stanley Zdonik
Object Orientated Database System Manifesto
Todd R. Manion
Objects Objects Everywhere
http://www.acm.org/crossroads/xrds7-3/objects.html#Rob
(accessed 14.12.2008)
Advantages of OODBMS
http://www.versant.com/en_US/products/odbms.html
(accessd 14.12.2008)
Vincent Coetzee, Rober Walker (2003)
Experiences using OODBMS for a High-Volume Internet Banking System
Object Orientated Databases (a)
http://courses.washington.edu/tcss445/tcss445A_16.ppt
(accessed 14.12.2008)
Object Orientated Databases (b)
http://www.elearning.strathmore.edu/file.php/183/Object-oriented_databases_abridged.ppt
(accessed 14.12.2008)
Overview RDBMS-ORDBMS-OODBMS
http://www.odbms.org/download/013.01%20Chountas%20RDBMS%20versus%20ORDBM
S%20versus%20OODBMS%20August%202005.pdf
(accessed 15.12.2008)
Oracle
http://www.oracle.com
(accessed 15.12.2008)
Microsoft SQL Server
http://www.microsoft.com/sqlserver/2008/en/us/default.aspx
(accessed 15.12.2008)
PostgreSQL
http://www.postgresql.org/
(accessed 15.12.2008)
Views
http://philip.greenspun.com/sql/views.html
(accessed 15.12.2008)
Hibernate
http://www.hibernate.org/
(accessed 15.12.2008)
Oracle9i Data Cartridge Developer's Guide
http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96595/dci03typ.htm
(accessed 15.12.2008)
Download