object oriented db (not in book)

55
11 1 Object oriented DB (not in book)

Upload: harry

Post on 14-Jan-2016

29 views

Category:

Documents


3 download

DESCRIPTION

Object oriented DB (not in book). Learning objectives:. What basic concepts govern OO systems How OO features are related to the more traditional relational and ER models What the basic features of an OO database management system (OODBMS) are - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Object oriented DB (not in book)

11

1

Object oriented DB (not in book)

Page 2: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

2

Learning objectives:

• What basic concepts govern OO systems

• How OO features are related to the more traditional relational and ER models

• What the basic features of an OO database management system (OODBMS) are

• What effect OO concepts are likely to have on data modeling and design

Page 3: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

3

Object Orientation and Its Benefits

• A set of design and development principles based on conceptually autonomous computer structures known as objects

• Each object represents a real-world entity with the ability to act upon itself and interact with other objects

• Modularity is therefore almost inevitable

Page 4: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

4

The Evolution of Object Oriented Concepts

• Object oriented programming

– Developed as an alternative to traditional programming methods

– Programmer creates or uses objects:

• Self-contained, reusable modules that contain data as well as the procedures used to operate on such data

Page 5: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

5

The Evolution of Object Oriented Concepts (continued)

• Object oriented programming languages were developed to:– Provide an easy-to-use software development

environment– Provide a powerful software modeling tool for

application development– Decrease development time by reducing the

amount of code– Improve programmer productivity by making

that code reusable

Page 6: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

6

The Evolution of Object Oriented Concepts (continued)

• Object oriented environment has several important attributes:

– Data set is no longer passive

– Data and procedures are bound together, creating an object

– Object has an innate ability to act on itself

Page 7: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

7

Object Oriented Concepts

• Have their roots in programming languages

• No knowledge of programming is necessary to understand these concepts

Page 8: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

8

Objects: Components and Characteristics

• Object:

– Abstract representation of a real-world entity

– Has:

• Unique identity

• Embedded properties

• Ability to interact with other objects and act upon itself

– Defining characteristic is its unique identity

Page 9: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

9

Real-World Student Objects

Page 10: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

10

Object Identity

• Unique to that object

• Assigned by system at moment of object’s creation

• Cannot be changed under any circumstances

• Can be deleted only if the object is deleted

• Can never be reused

Page 11: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

11

Attributes (Instance Variables)

• Attributes:

– Known as instance variables in OO environment

• Domain:

– Logically groups and describes the set of all possible values that an attribute can have

Page 12: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

12

Object Attributes

Page 13: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

13

Object State

• Set of values that object’s attributes have at a given time

• Can vary, although its OID remains the same

• To change the object’s state, change the values of the object’s attributes

• To change the object’s attribute values, send a message to the object

– Message will invoke a method

Page 14: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

14

Messages and Methods• Method:

– Code that performs a specific operation on object’s data

– Protects data from direct and unauthorized access by other objects

– Used to change the object’s attribute values or to return the value of selected object attributes

– Represent real-world actions

Page 15: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

15

Method Components

Page 16: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

16

Objects Send Messages to Each Other

Page 17: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

17

Classes

• Collection of similar objects with shared structure (attributes) and behavior (methods)

• Class instance or object instance

– Each object in a class

Page 18: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

18

Class Illustration

Page 19: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

19

Protocol

• An object’s public aspect

• How it is known by other objects as well as end users

• Other objects communicate with the student object using any of these methods

Page 20: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

20

Public and Private Aspects of an Object

Page 21: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

21

Musical Instruments Class Hierarchy

Page 22: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

22

Single Inheritance

Page 23: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

23

Multiple Inheritance

Page 24: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

24

Employee Class Hierarchy Method Override

Page 25: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

25

Employee Class Hierarchy Polymorphism

Page 26: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

26

Object Classification

• Simple object Only single value attributes

• Composite object Contains at least one multi-value attributes and no attributes that refer to other objects; ex: MOVIE

• Compound object : Contains attribute that refer to other objects. Ex: Advisor

• Associative object: represents relationship between two or more objects: ex: enrollment

Page 27: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

27

Characteristics of an Object Oriented Data Model

• Support the representation of complex objects

• Are extensible:– Capable of defining new data types as well as

the operations to be performed on them

• Support encapsulation:– Data representation and method’s

implementation must be hidden from external entities

Page 28: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

28

Characteristics of an Object Oriented Data Model (continued)

• Exhibit inheritance:

– Object must be able to inherit properties (data and methods) of other objects

• Support the notion of object identity (OID)

Page 29: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

29

Comparing the OO and ER Model Components

Page 30: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

30

Shared Representation for All Objects of the Class Person

Page 31: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

31

State of a Person Object Instance

Page 32: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

32

Referential Object Sharing

Page 33: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

33

Class Hierarchy

Page 34: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

34

Employee Object Representation

Page 35: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

35

Representing a 1:M Relationship

Page 36: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

36

Representing 1:1 and 1:M Relationships

Page 37: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

37

Employee-Dependent Relationship

Page 38: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

38

Representing the M:N Relationship

Page 39: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

39

Representing the M:N Relationship with Associated Attributes

Page 40: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

40

Representing the M:N Relationship with Intersection Class

Page 41: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

41

Object Space Representation

Page 42: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

42

Late and Early Binding: Use and Importance

• Late binding: – Data type of an attribute is not known until

execution time or runtime

– Two different object instances of the same class can contain values of different data types for the same attribute

• Early binding: – Allows database to check data type for each of

the attribute’s values at compilation or definition time

Page 43: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

43

INVENTORY Table with Predetermined (Base) Data Types

Page 44: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

44

Inventory Class with Early Binding

Page 45: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

45

OODM Inventory Class with Late Binding

Page 46: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

46

Support for Versioning

• Allows users to track history of changes in state of an object

• If the changes do not yield expected results, they can be undone and the component restored to its original state

• Reason OODBMS is such a strong player in the CAD and computer-aided manufacturing (CAM) arenas

Page 47: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

47

OODM and Previous Data Models: Similarities and Differences

• OODM object resembles entity and tuple in the ER and relational models but has additional characteristics

• Class • Hierarchies• Encapsulation • Object ID (OID) not supported• Relationships • OODM produces a schema in which relations

form part of the structure of the database

Page 48: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

48

An Invoice Representation

Page 49: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

49

Assume the following business rules:• A course contains many Sections, but each Section references only one

course.• A Section is taught by one professor, but each professor may teach one

or more different Sections of one or more courses.• A Section may contain many students, and each student may be enrolled

in many Sections.• A Section may contain many students, and each student is enrolled in

many Sections, but each Section belongs to a different course. (Students may take many courses, but they cannot take many Sections of the same course!)

• Each Section is taught in one room, but each room may be used to teach different Sections of one or more courses.

• A professor advises many students, but a student has only one advisor.Based on these business rules:• a. Identify and describe the main classes of objects.• B. Draw the object oriented diagram

Page 50: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

50

• See figure p3.8 on 7/p95 • Draw object oriented diagram for it

Page 51: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

51

Object Oriented Database Management Systems

• Integrate benefits of typical database systems with the more powerful modeling and computational (programming) characteristics of the object oriented data model

• Used to develop complex systems

Page 52: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

52

Object Oriented Database Management Systems

• Result of combining OO features, such as– class inheritance– encapsulation, and

– polymorphism, • With database features such as

– data integrity, -- data manipulation,– security, -- system tuning and– persistence, -- recovery– transaction management, – concurrency control, – backup,

Page 53: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

53

Object Oriented Database Management Systems

Page 54: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

54

How Object Orientation Affects Database Design

• Relational and ER models sometimes cannot adequately represent some objects

• Operations are not a part of the database model

• Object oriented design requires the database description to include objects and their data representation, constraints, and operations

• Few computerized OODB design tools exist• Lack of standards affects object oriented

database design

Page 55: Object oriented DB (not in book)

Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel

11

55

OODBMS:Advantages and Disadvantages

• OODBMS occupies a strong niche market

• Vehicle for technological innovation

• Has not been the beneficiary of market share growth