Object Oriented Database

Download Report

Transcript Object Oriented Database

Object Oriented Database
By Ashish Kaul
References from Professor Lee’s
presentations and the Web.
Object Oriented Database
• As we have been discussing in class already, today I will be going
over Object Oriented Database …
• To begin I will discuss why we would choose to use this style of a
database over a relational database.
Object Oriented Database vs. Relational Database
• 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.
Object Oriented Database vs. Relational Database cont…
• To put objects into relational databases, they must be described in
terms of simple string, integer, or real number data. For instance in
the case of an airplane. The wing may be placed in one table with
rows and columns describing its dimensions and characteristics.
The fuselage may be in another table, the propeller in another table,
tires, and so on.
• Breaking complex information out into simple data takes time and is
labor intensive. Code must be written to accomplish this task.
Object Oriented Database Advantages
• Objects don't require assembly and disassembly saving coding time
and execution time to assemble or disassemble objects.
• Reduced paging
• Easier navigation
• Better concurrency control - A hierarchy of objects may be locked.
• Data model is based on the real world.
• Works well for distributed architectures.
• Less code required when applications are object oriented.
Object Oriented Database Disadvantages
• Lower efficiency when data is simple and relationships are simple.
• Relational tables are simpler.
• Late binding may slow access speed.
• More user tools exist for RDBMS.
• Standards for RDBMS are more stable.
• Support for RDBMS is more certain and change is less likely to be
required.
Object Oriented Database Programming Terminology
• Object Identity (OID)
• Attributes (Instance variables)
• Object State
• Messages and Methods
• Encapsulated Structure
– The ability to hide the object’s internal details
Object Oriented Database Programming Terminology cont…
• Object Class
– the logical structure of an object (name, attributes, methods)
• Object Class Library
– a group of object classes
• Object
– an instance of an object class
• Protocol –
– collection of messages
Object Oriented Database Programming Terminology cont…
• Superclasses
• Subclasses
• Inheritance
– Single
– Multiple
• Polymorphism
– situation in which one name can be used to invoke different
functions
• Inheritance
– automatically assuming the attributes and methods of another
object at a higher class
13 Rules for an OODBMS from the OODBS Manifesto
•
•
•
•
•
•
•
•
•
•
•
•
•
System must support complex objects
Object identifier must be supported
Objects must be encapsulated
Systems must support types or classes
System must support inheritance
System must avoid premature binding
System must be computationally complete
System must be extensible
System must be able to remember data locations
System must be able to handle very large databases
System must support concurrent users
System must be able to recover from hardware and software
Data query must be simple
Where Object Oriented Databases are used
• Medical care – X-rays, MRI, CT scans, and EKG traces
• Spatial and geographic databases – maps, seismic data, satellite
images, CAD drawings
• Financial systems – time series data and analysis
How Object Oriented Databases are created
• Impossible for a database vendor or a standards organization to
incorporate all of these complex data types as an integral part of the
RDBMS
• What we need is the capability to extend the set of built-in data
types of the RDBMS
• A class encapsulating the data and methods of an ADT should
satisfy the requirements
How Object Oriented Databases are created cont…
• A new ADT would be implemented as a class in some objectoriented language
• The class would then be registered with the database system
• Once registered, the ADT becomes a candidate for an attribute type
• SQL extensions would allow the class methods to be used in
queries
How Object Oriented Databases are created cont…
• The class is typically called a user-defined type (UDT)
• The class methods are called user-defined functions (UDF)
• Most implementations do not store instances of a class as part of a
tuple
• Instead, a tuple contains a handle that refers to the instance of the
UDT
How Object Oriented Databases are created cont…
• The data members of objects might be stored in one or more hidden
tables
• Hidden indices can be implemented to accelerate access to the
objects
• The object handle would also be used to access the UDFs of the
class
• Some implementations allow the class designer to implement new
access methods
How Object Oriented Databases are created cont…
• In these systems, a designer could simply use the index structures
built into the DBMS – typically B+-trees
• For complex data, it may be faster to use a different structure
• Example – for searching spatial data, the
R-tree (to be discussed later) would be a better choice
How Object Oriented Databases are created cont…
• A common use of UDTs is implement a container to hold multiple
objects of the same (built-in or user-defined) type
• Such a type can be used to create a multivalued attribute
• Such a datatype does not violate first normal form, since the table
does not contain repeating columns of the same type
Object Oriented Database
By Ashish Kaul
THE END!!!!