Slide Template

Download Report

Transcript Slide Template

Chapter 16
Object-Oriented Database Processing
Fundamentals, Design,
and Implementation, 9/e
Introduction
 Relational databases are not well-suited to store
object-oriented programming objects because
tables cannot store complex object structures
including methods
 Object-Oriented DBMS (ODBMS or OODBMS) is
a special-purpose DBMS developed in the early
1990s to provide persistent object storage
– These products have not been commercially successful
because existing data must be converted into ODBMS
format
 DBMS products begin to support object-relational
databases, hybrids of object and relational storage
Copyright © 2004 Database Processing: Fundamentals, Design, and Implementation, 9/e
by David M. Kroenke
Chapter 16/2
Object-Oriented Programming
 Object-oriented programming (OOP) is a
way of designing and coding programs
 Traditional programming
– Views programs as sequences of instructions to
be processed
– Is organized around logic first and data second
 Object-oriented programming
– Views programs as sets of data structures that
have both data elements and program
instructions
– Is organized around data first and logic second
Copyright © 2004 Database Processing: Fundamentals, Design, and Implementation, 9/e
by David M. Kroenke
Chapter 16/3
OOP Terminology
 An OOP object is an encapsulated structure having
both attributes and methods
– Encapsulated means that it is complete in itself
• Programs external to an object know nothing of its
structure and need to know nothing of its structure
– Methods are sequences of instructions that the object
executes
• OOP objects interact by calling each other’s methods
 An interface is the external appearance of an object
 An implementation is the encapsulated interior of an
object
Copyright © 2004 Database Processing: Fundamentals, Design, and Implementation, 9/e
by David M. Kroenke
Chapter 16/4
OOP Terminology (cont.)
 A subclass object inherits the attributes and
methods of its superclass
 Polymorphism allows several versions of the same
method to exist
– The compiler creates code to call the proper version,
depending on the object class
 An object class is the logical structure of an object
– An object class library is a group of object classes
– Objects or object instances are instances of an object
class
Copyright © 2004 Database Processing: Fundamentals, Design, and Implementation, 9/e
by David M. Kroenke
Chapter 16/5
OOP Terminology (cont.)
 Object constructors are methods that obtain
memory and create object structures
 Object destructors unbind objects and free
memory
 Transient objects exist only during the execution of
a program
 Persistent objects are saved to storage and
survive the execution of a program
Copyright © 2004 Database Processing: Fundamentals, Design, and Implementation, 9/e
by David M. Kroenke
Chapter 16/6
Example: CUSTOMER Object
Copyright © 2004 Database Processing: Fundamentals, Design, and Implementation, 9/e
by David M. Kroenke
Chapter 16/7
Example: Object Data Structures
Copyright © 2004 Database Processing: Fundamentals, Design, and Implementation, 9/e
by David M. Kroenke
Chapter 16/8
Object Persistence
 Object Persistence Requirements
– Save object instance data values
– Convert in-memory object pointers to
permanent, unique IDs (swizzling)
– Save object class methods
 Objects can be made persistent by using
– Traditional file storage
– Relational DBMS
– ODBMS
Copyright © 2004 Database Processing: Fundamentals, Design, and Implementation, 9/e
by David M. Kroenke
Chapter 16/9
Object Persistence Alternatives
Copyright © 2004 Database Processing: Fundamentals, Design, and Implementation, 9/e
by David M. Kroenke
Chapter 16/10
Object Persistence Using Oracle
 Oracle supports object persistence using objectrelational database facilities
 Object types can be defined and used with table
structures as
–
–
–
–
Column objects
Variable length arrays
Nested tables
Row objects
 Pure objects can also be defined to include
– Variable length arrays and nested tables
– Object pointers as REF attributes
– Methods, which can use Oracle-supplied class libraries
for processing
Copyright © 2004 Database Processing: Fundamentals, Design, and Implementation, 9/e
by David M. Kroenke
Chapter 16/11
ODBMS Standards
 SQL3
– ANSI and ISO proposed SQL3 as an extension to SQL-92
– SQL3 begins with a database perspective and moves toward
object thinking
 ODMG-93
– First published in 1993 by the Object Data Management
Group
– ODMG is supported by a consortium of object database
vendors and other interested industry experts
– ODMG begins with an object perspective and moves toward
data management thinking
Copyright © 2004 Database Processing: Fundamentals, Design, and Implementation, 9/e
by David M. Kroenke
Chapter 16/12
SQL3 Key Developments
 Abstract Data Types (ADT): a user-defined
structure equivalent to an OOP object
– Object ADTs have identifiers called OIDs
 SQL3 table definition extensions
– SQL3 tables have a row identifier and can have subtable
• A subtable is a subset of supertable and it inherits all of the
columns of its supertable and may also have columns of its
own
– Three types of table: SET, MULTISET, LIST
 SQL language extensions supporting ADT
methods coding
Copyright © 2004 Database Processing: Fundamentals, Design, and Implementation, 9/e
by David M. Kroenke
Chapter 16/13
ODMG-93 Key Elements
 Objects are the fundamental data structure
 Every object has a lifelong persistent,
unique identifier
 Objects can be arranged into types and
subtypes
 State is defined by data values and
relationships
 Behavior is defined by object operations
Copyright © 2004 Database Processing: Fundamentals, Design, and Implementation, 9/e
by David M. Kroenke
Chapter 16/14
Chapter 16
Object-Oriented Database Processing
Fundamentals, Design,
and Implementation, 9/e