Object-Oriented Methods: Database Technology
Download
Report
Transcript Object-Oriented Methods: Database Technology
Object-Oriented Methods:
Database Technology
An introduction
Lecture Overview
Background
Database
Relational versus OO
Solutions for Object Persistence
Object-Oriented Database
Object-Relational
Commercially available products
Database systems
Primary purpose:
Managing persistent data
Provide efficient and safe access to very large
quantities of data via high level query language
Other common features
Transaction management in a multi-user environment
Control of data ownership and access
Validation and consistency checking
Recovery from system and hardware failure
Motivation
OO applications need object persistence
Persistence – ability to exist beyond the running
time of an application. Implemented by storing
the objects off-line on a secondary storage
device
No strong support for persistence in OOPL’s
One solution…
Could use a relational database (RDBMS)
Store objects in the form of attribute tables
Main or virtual
memory
Transformation and type checking
Secondary storage
Problems with using relational model
Programmer needs to write code for
Translate from application’s object model into RDBMS (could
take up to 30 % of coding effort)
Type checking
In relational model, typically many normalized
tables are used to represent a real-world object.
Tables are combined using joins – a slow
operation!
Especially problematic for complex objectsa noticeable overhead in application-database
communication in order to reconstruct an entire
object.
Benefits of relational model
Well grounded in theory, thus
Portability: once written, the database
application can be easily converted to another
vendor’s RDBMS
Powerful query mechanism
Object-oriented database (OODB)
Database + Object Orientation
Conceptually, an object in OODB stores both attributes
and methods (services)
In reality, the data (attributes) are stored separately
from the methods code.
Methods could be written in an OO programming
language.
Supports object identity, inheritance, whole-part
relations and object associations.
OQL – object query language
Object-oriented database (OODB)
Main or virtual
memory
Secondary storage
Intuitively clear idea, but needs a clever way of managing
representations of objects in memory an on disk to achieve the
illusion of transparency (pointer swizzling)
Benefits of object-oriented database
Can be directly used from an OO program
2. Is semantically richer (can express more)
than the relational model
3. Other factors
1.
Benefits of object-oriented database
1. Can be directly used from an OO program
Uniform mode in which real world concepts are
represented throughout the system, including the
database component simplifies the design and
implementation
2. Semantic richness of OO data model
Can express whatever an entity-relationship,
hierarchical and network model can express and
more
Benefits of object-orientation in
database
Mirrors benefits of OO: ease of reuse and
extensibility
Better performance over other representations when
complex objects and complex relationships must be
dealt with, because there is no need to break up large
objects into many normalized tables and reassemble
them via join operations.
Example domains: engineering drawings and complex
graphics
Benefits of object-orientation in
database
3. … continued
Generally better navigation control over queries,
because pointers to related objects are stored in
objects themselves.
Easier to identify parts of the data that is likely to be
accessed simultaneously. Keeping related (via
instance connections, whole-part relations) objects
close together and retrieving them simultaneously
usually minimizes disk access time.
Map well on distributed architectures.
Pitfalls of object-oriented databases
No universally accepted object-oriented data
model, and resulting discrepancies in
commercially available products
Although some have wide acceptance and may converge to one
eventually
ODMG – a consortium of OODB vendors works to establish
standrad Object Data Language (ODL) and Object Query
Language (OQL)
Performance depends on a type of application
Still unresolved problems concerning concurrency,
locking and query optimization
Relational versus OODB
•Relational model fits well the application domains that are
regular and have large number of instances
•Examples: many traditional banking applications, payroll,
personnel data, etc
•OODB fits well application domains with sparse complex
objects
•Examples: complex graphics, CAD systems, multimedia,
complex inventory, etc
Object-relational databases
Original name– Extended Relational DBMS
Based on SQL, enriched with OO features
SQL3 standard
Most database vendors are pushing in this
direction.
Commercial systems
ODBMS
ObjectStore – good performance, C++ and Java
interface
O2 – supports OQL, pioneered a lot of concepts in
OODatabase, used for many commercial applications.
Programming environment includes graphical browser
and debugger.
Object-Relational
ORDB (formerly UniSQL) – flexible query
capabilities of a relational product combined with
semantic richness of an object-oriented one.