Upload
gavin-gibbs
View
223
Download
2
Tags:
Embed Size (px)
Citation preview
Chapter 10Chapter 10Object-Oriented Object-Oriented
Database ManagementDatabase Management
Fundamentals of Database Management Systemsby
Mark L. Gillenson, Ph.D.
University of Memphis
Presentation by: Amita Goyal Chin, Ph.D.
Virginia Commonwealth University
John Wiley & Sons, Inc.
10-10-22
Chapter ObjectivesChapter Objectives
List several limitations in the relational database List several limitations in the relational database model. model.
Describe the object-oriented database concept. Describe the object-oriented database concept.
Model data using such complex relationships as Model data using such complex relationships as generalization and aggregation, and such generalization and aggregation, and such concepts as inheritance and polymorphism. concepts as inheritance and polymorphism.
10-10-33
Chapter ObjectivesChapter Objectives
Describe the benefits of encapsulation. Describe the benefits of encapsulation.
Describe the value of developing abstract Describe the value of developing abstract data types. data types.
Explain what an object/relational database Explain what an object/relational database is. is.
10-10-44
Historically SpeakingHistorically Speaking
For much of IS history the emphasis was For much of IS history the emphasis was on the programs, with the data structures on the programs, with the data structures and ultimately the data stored in them and ultimately the data stored in them being a secondary consideration.being a secondary consideration.
The IS environment is changing from this The IS environment is changing from this program-centric mentality into a more program-centric mentality into a more data-centric one. data-centric one.
10-10-55
Object OrientationObject Orientation
An alternative approach to information An alternative approach to information systems and IS development.systems and IS development.
Began during the 1980s.Began during the 1980s.
More data-centric.More data-centric.
10-10-66
What’s Missing in the What’s Missing in the Relational Database Concept?Relational Database Concept? Many people would say that nothing is Many people would say that nothing is
missing from the relational model.missing from the relational model.
Others would point out that for certain Others would point out that for certain kinds of complex applications, the kinds of complex applications, the relational model is lacking in support for relational model is lacking in support for the more complex data model features the more complex data model features they need.they need.
10-10-77
What’s Missing in the What’s Missing in the Relational Database Concept?Relational Database Concept? Does not directly provide support for Does not directly provide support for
generalization/specialization.generalization/specialization.
Does not directly provide support for Does not directly provide support for aggregation.aggregation.
10-10-88
What’s Missing in the What’s Missing in the Relational Database Concept?Relational Database Concept? Does not have a system in which only a limited, Does not have a system in which only a limited,
controlled set of program segments is allowed to update controlled set of program segments is allowed to update particular data.particular data.
Does not directly support more complex data types such Does not directly support more complex data types such as:as: graphic imagesgraphic images photo imagesphoto images video clipsvideo clips audio clipsaudio clips long text documentslong text documents mathematical constructs such as matricesmathematical constructs such as matrices
10-10-99
Terminology: Object-Oriented Terminology: Object-Oriented Data ModelingData Modeling
Object - describes an advanced data Object - describes an advanced data structure that includes an entity’s attributes structure that includes an entity’s attributes plus methods or operations or procedures plus methods or operations or procedures (program code!) that can operate on and (program code!) that can operate on and modify the object’s attribute values.modify the object’s attribute values.
(object) class - the objects that describe (object) class - the objects that describe similar entities. similar entities.
10-10-1010
More advantages of Object More advantages of Object Oriented Database ConceptOriented Database Concept
Each object has an object identifier that is permanent Each object has an object identifier that is permanent and unique among all objects of all types in the system.and unique among all objects of all types in the system.
Some OODBMSs are implemented as pointer-based Some OODBMSs are implemented as pointer-based systems.systems. related objects are “connected” by their storage addresses.related objects are “connected” by their storage addresses.
OODBMSs are the most natural data storage vehicles OODBMSs are the most natural data storage vehicles when object-oriented programming languages, such as when object-oriented programming languages, such as C++, Smalltalk, and Java, are in use. C++, Smalltalk, and Java, are in use.
10-10-1111
Unified Modeling LanguageUnified Modeling Language
Introduced in 1997 by the Object Introduced in 1997 by the Object Management Group (OMG)Management Group (OMG)
Has nine standard diagrams that describe:Has nine standard diagrams that describe: the system’s datathe system’s data the business processesthe business processes the intended resultsthe intended results the components of the program codethe components of the program code the hardware and software architectures.the hardware and software architectures.
10-10-1212
UML Class DiagramUML Class Diagram
Describes the system’s data, including Describes the system’s data, including attributes of and relationships between the attributes of and relationships between the “objects.”“objects.”
10-10-1313
GeneralizationGeneralization
Also known as Also known as generalization/specializationgeneralization/specialization
Is a relationship that recognizes that some Is a relationship that recognizes that some kinds of entities can be subdivided into kinds of entities can be subdivided into smaller, more specialized groups.smaller, more specialized groups.
10-10-1414
General Hardware Company General Hardware Company ERDERD
General Hardware General Hardware company E-R company E-R diagram.diagram.
General Hardware is General Hardware is a wholesaler.a wholesaler.
10-10-1515
General Hardware Company General Hardware Company Generalization DiagramGeneralization Diagram
Each box represents a Each box represents a class and has three class and has three sections separated by sections separated by horizontal lines.horizontal lines. At the top, in capital letters, At the top, in capital letters,
is the class nameis the class name
In the middle are the class In the middle are the class attributesattributes
At the bottom are the class At the bottom are the class operations (not shown)operations (not shown)
10-10-1616
General Hardware Company General Hardware Company Generalization DiagramGeneralization Diagram
The upward pointing arrows The upward pointing arrows indicate generalizations.indicate generalizations.
There are three kinds of There are three kinds of productsproducts TOOLsTOOLs LIGHT FIXTUREsLIGHT FIXTUREs LUMBERLUMBER
There are two kinds of toolsThere are two kinds of tools POWER TOOLsPOWER TOOLs NONPOWER TOOLsNONPOWER TOOLs
10-10-1717
Inheritance of AttributesInheritance of Attributes
The PRODUCT class The PRODUCT class indicates that all products indicates that all products have three common have three common attributes: Product attributes: Product Number, Product Name, Number, Product Name, and Unit Price.and Unit Price.
All of the classes below All of the classes below PRODUCT PRODUCT inheritinherit the the attributes shown in attributes shown in PRODUCT.PRODUCT.
10-10-1818
Inheritance of AttributesInheritance of Attributes
The attributes for The attributes for POWER TOOLs are:POWER TOOLs are:
(from Product)(from Product)• Product NumberProduct Number• Product NameProduct Name• Unit Price Unit Price
(from TOOL)(from TOOL)• WeightWeight
(from POWER TOOL)(from POWER TOOL)• AmperesAmperes
10-10-1919
Inheritance of AttributesInheritance of Attributes The attributes for The attributes for
NONPOWER TOOLs areNONPOWER TOOLs are
(from Product)(from Product)• Product NumberProduct Number• Product NameProduct Name• Unit Price Unit Price
(from TOOL)(from TOOL)• WeightWeight
(from NON-POWER (from NON-POWER TOOL)TOOL)
• Years of WarrantyYears of Warranty
10-10-2020
Inheritance of AttributesInheritance of Attributes
The attributes for LIGHT The attributes for LIGHT FIXTUREs areFIXTUREs are
(from Product)(from Product)• Product NumberProduct Number• Product NameProduct Name• Unit Price Unit Price
(from LIGHT (from LIGHT FIXTURE)FIXTURE)
• Number of BulbsNumber of Bulbs• Watts per BulbWatts per Bulb
10-10-2121
Inheritance of AttributesInheritance of Attributes
The attributes for The attributes for LUMBER areLUMBER are
(from Product)(from Product)• Product NumberProduct Number• Product NameProduct Name• Unit Price Unit Price
(from LUMBER)(from LUMBER)• Type of WoodType of Wood• DimensionsDimensions
10-10-2222
OperationsOperations
Operations have now Operations have now been added to the been added to the UML Diagram.UML Diagram.
There are three kinds There are three kinds of operations:of operations: ConstructorConstructor QueryQuery UpdateUpdate
10-10-2323
Operations: ConstructorOperations: Constructor
Creates a new Creates a new instance of a class, instance of a class, that is, a new object.that is, a new object.
Example: Add Example: Add LumberLumber an operation that will an operation that will
add a new instance of add a new instance of LUMBER, that is, a LUMBER, that is, a new object, to the new object, to the database.database.
10-10-2424
Operations: QueryOperations: Query
Returns data about the Returns data about the values of an object’s values of an object’s attributes but does not attributes but does not update them.update them.
Example: Calculate Example: Calculate DiscountDiscount calculates a discount for a calculates a discount for a
particular customer buying particular customer buying a particular product and a particular product and returns the result to the returns the result to the user who issued the query, user who issued the query, but does not store the but does not store the result in the database.result in the database.
10-10-2525
Operations: UpdateOperations: Update
Updates an object’s Updates an object’s attribute values.attribute values.
Example: Change Unit Example: Change Unit PricePrice a product’s unit price a product’s unit price
may have to be may have to be changed, and the changed, and the result is stored in the result is stored in the database as the new database as the new unit price. unit price.
10-10-2626
PolymorphismPolymorphism
Modification or refinement Modification or refinement of operations as they are of operations as they are inherited downward.inherited downward.
The operations that are The operations that are performed differently in performed differently in the lower level objects the lower level objects can have modified names can have modified names and will perform and will perform differently for the different differently for the different kinds of objects.kinds of objects.
10-10-2727
PolymorphismPolymorphism
Looking at “Calculate Discount”:Looking at “Calculate Discount”: Since there is nothing more said Since there is nothing more said
about the discount further down about the discount further down the hierarchy, the discount is the hierarchy, the discount is calculated calculated in the same wayin the same way for all for all kinds of products.kinds of products.
Looking at “Calculate Extended Looking at “Calculate Extended Warranty Price”:Warranty Price”: polymorphism occurs in the polymorphism occurs in the
Calculate Extended Warranty Calculate Extended Warranty Price operation because it is Price operation because it is performed differently for power performed differently for power tools and nonpower tools.tools and nonpower tools.
10-10-2828
AggregationAggregation
10-10-2929
AggregationAggregation
A class is shown to A class is shown to be composed of other be composed of other classes.classes.
FRAMEs and BULBS FRAMEs and BULBS are not kinds of are not kinds of LIGHT FIXTUREs; LIGHT FIXTUREs; rather, each is a part rather, each is a part of a LIGHT FIXTURE. of a LIGHT FIXTURE.
10-10-3030
General Hardware Company General Hardware Company Class DiagramClass Diagram
10-10-3131
Good Reading Bookstores Good Reading Bookstores Class DiagramClass Diagram
A generalization A generalization hierarchy has been hierarchy has been created under created under PRODUCT, which PRODUCT, which indicates that there are indicates that there are four kinds of products: four kinds of products: BOOK, PERIODICAL, BOOK, PERIODICAL, CD, and VIDEO/DVD.CD, and VIDEO/DVD.
The PERIODICAL class, The PERIODICAL class, and only this class, is and only this class, is associated with the associated with the ARTICLE class.ARTICLE class.
10-10-3232
World Music Association World Music Association Class DiagramClass Diagram
A generalization A generalization hierarchy has been hierarchy has been constructed with constructed with subordinate classes subordinate classes ORCHESTRA, ORCHESTRA, CHAMBER GROUP, CHAMBER GROUP, and JAZZ GROUP. and JAZZ GROUP.
10-10-3333
Lucky Rent-A-VehicleLucky Rent-A-VehicleClass DiagramClass Diagram
Lucky Rent-A-Car has Lucky Rent-A-Car has expanded to become Lucky expanded to become Lucky Rent-A-Vehicle!Rent-A-Vehicle!
A two-level generalization A two-level generalization hierarchy under VEHICLE.hierarchy under VEHICLE.
The diamond-shaped symbol The diamond-shaped symbol on the branch under the on the branch under the TRUCK class indicates that TRUCK class indicates that there is an aggregation there is an aggregation diagram under it.diagram under it.
10-10-3434
EncapsulationEncapsulation
The attributes of a class or even an individual object are “encapsulated,” The attributes of a class or even an individual object are “encapsulated,” stored together on the disk, with the operations that will act upon them.stored together on the disk, with the operations that will act upon them.
OODBMS will only permit the attributes of the encapsulated objects to OODBMS will only permit the attributes of the encapsulated objects to be updated by the encapsulated update-type operations, thereby be updated by the encapsulated update-type operations, thereby improving data integrity.improving data integrity.
10-10-3535
EncapsulationEncapsulation
When an application program requires encapsulated When an application program requires encapsulated data, it sends a message to one of the object’s data, it sends a message to one of the object’s encapsulated operations to trigger it into action.encapsulated operations to trigger it into action.
The application program sends along any input data The application program sends along any input data needed for the operation.needed for the operation.
10-10-3636
Abstract Data TypesAbstract Data Types
Object-oriented Object-oriented database allows the database allows the creation of new, creation of new, abstract data types abstract data types and operations that and operations that are associated with are associated with them. them.
10-10-3737
Object/Relational DatabaseObject/Relational Database
OODBMSs were lacking in several areas, OODBMSs were lacking in several areas, including the superior query capabilities of SQL including the superior query capabilities of SQL that everyone had become accustomed to.that everyone had become accustomed to.
Relational database and object-oriented Relational database and object-oriented database have come together in the form of database have come together in the form of hybrid relational database management systems hybrid relational database management systems with object-oriented features added to them.with object-oriented features added to them.
10-10-3838
General Hardware Company as General Hardware Company as an Object/Relational Databasean Object/Relational Database
10-10-3939
“Copyright 2004 John Wiley & Sons, Inc. All rights reserved. Reproduction or translation of this work beyond that permitted in Section 117 of the 1976 United States Copyright Act without express permission of the copyright owner is unlawful. Request for further information should be addressed to the Permissions Department, John Wiley & Sons, Inc. The purchaser may make back-up copies for his/her own use only and not for distribution or resale. The Publisher assumes no responsibility for errors, omissions, or damages caused by the use of these programs or from the use of the information contained herein.”