Presentation is loading. Please wait.

Presentation is loading. Please wait.

11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.

Similar presentations


Presentation on theme: "11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel."— Presentation transcript:

1 11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel

2 11 Object Orientation and Its Benefits 4Object orientation is a modeling and development methodology based on object-oriented (OO) concepts. 4Definition of Object Orientation 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 interact with itself and with other objects.

3 11 Table 11.1 Object Orientation Contributions

4 11 The Evolution of OO Concepts 4From traditional to object-oriented programming (OOP) u Before OOP, data and procedures were isolated from each other. Data were treated as the passive component, while procedures manipulated the data as the active component. u Procedural languages (e.g., COBOL) encouraged the rigid distinction between data and procedure. u In an OOP environment, the programmer asks to perform operations on themselves. u OO concepts first appeared in some programming languages and set the stage for more refined OO concepts.

5 11 The Evolution of OO Concepts 4Main Objectives of Object-Oriented Programming Languages (OOPL) u To provide an easy-to-use software development environment. u To provide a powerful software modeling tool for applications prototyping. u To decrease development time by reducing the amount of code. u To improve programmer productivity by making that code reusable.

6 11 The Evolution of OO Concepts 4Important Attributes of OO Environment u The data set is no longer passive. u Data and procedures are bound together, creating an object. u The object has an innate ability to act on itself.

7 11 Object-Oriented Concepts 4Overview u Objects: Components and Characteristics u Object Identity u Attributes (Instance Variables) u Object State u Messages and Methods u Classes u Protocol u Superclasses, Subclasses, and Inheritance u Methods Overriding and Polymorphism u Abstract Data Types u Object Classification

8 11 Object-Oriented Concepts 4Objects: Components and Characteristics An object is an abstract representation of a real-world entity that has a unique identity, embedded properties, and the ability to interact with other objects and itself. Figure 11.1 Real World Student Objects

9 11 Object-Oriented Concepts 4Object Identify u The object’s identity is represented by an object ID (OID), which is unique to that object. u The OID is assigned by the system at the moment of the object’s creation and cannot be changed under any circumstance. u The OID can be deleted only if the object is deleted, and that OID can never be reused.

10 11 Object-Oriented Concepts 4Attributes (Instance Variables) u Objects are described by their attributes, known as instance variables. (See Table 11.2) u Attributes have a domain. The domain logically groups and describes the set of all possible values that an attribute can have. u An attribute can be single valued or multivalued. u Attributes may reference one or more other objects.

11 11 Object Attributes Table 11.2

12 11 Object-Oriented Concepts 4Object State u The object state is the set of values that the object’s attributes have at a given time. l If we change the object’s state, we must change the values of the object attributes. l To change the object’s attribute values, we must send a message to the object. l This message invokes a method.

13 11 Object-Oriented Concepts 4Messages and Methods u Every operation performed on an object must be implemented by a method. l Methods represent real-world actions and are equivalent to procedures in traditional programming languages. u Every method is identified by a name and has a body. l The body is composed of computer instructions written in some programming language to represent a real-world action.

14 11 Depiction Of An Object Figure 11.2

15 11 Object-Oriented Concepts 4Messages and Methods u To invoke a method you send a message to the object. l A message is sent by specifying a receiver object, the name of the method, and any required parameters. l The internal structure of the object cannot be accessed directly by the message sender. The ability to hide the object’s internal details (attributes and methods) is known as encapsulation. l An object may send messages to change or interrogate another object’s state. (See Figure 11.3)

16 11 Objects Send Messages To Each Other Figure 11.3

17 11 Object-Oriented Concepts 4Classes u Objects that share common characteristics are grouped into classes. A class is a collection of similar objects with shared structure (attributes) and behavior (methods). u Each object in a class is known as a class instance or object instance. (See Figure 11.4) u Example: STUDENT class (See Figure 11.5)

18 11 Class Illustration Figure 11.4

19 11 Representation Of The Class Student Figure 11.5

20 11 Object-Oriented Concepts 4Protocol u The class’s collection of messages, each identified by a message name, constitutes the object or class protocol. u The protocol represents an object’s public aspect; i.e., it is known by other objects as well as end users. u The implementation of the object’s structure and methods constitutes the object’s private aspect. u A message can be sent to an object instance or the class. When the receiver object is a class, the message will invoke a class method.

21 11 Public and Private Aspects Of An Object Figure 11.6

22 11 OO Summary: Object Characteristics Figure 11.7

23 11 Object-Oriented Concepts 4Superclasses, Subclasses, and Inheritance u Classes are organized into a class hierarchy. l Example: Musical instrument class hierarchy (Figure 11.8) –Piano, Violin, and Guitar are a subclass of Stringed instruments, which is, in turn, a subclass of Musical instruments. –Musical instruments defines the superclass of Stringed instruments, which is, in turn, the superclass of the Piano, Violin, and Guitar classes. u Inheritance is the ability of an object within the hierarchy to inherit the data structure and behavior (methods) of the classes above it.

24 11 Musical Instruments Class Hierarchy Figure 11.8

25 11 Object-Oriented Concepts 4Two variants of inheritance: u Single inheritance exists when a class has only one immediate superclass above it. l Most of the current OO systems support single inheritance. l When the system sends a message to an object instance, the entire hierarchy is searched for the matching method in the following sequence: –Scan the class to which the object belongs. –If the method is not found, scan the superclass. l The scanning process is repeated until either one of the following occurs: –The method is found. –The top of the class hierarchy is reached without finding the message.

26 11 Single Inheritance Figure 11.9

27 11 Object-Oriented Concepts 4Two variants of inheritance: u Multiple inheritance allow a class to be derived from several parent superclasses located above that class. u Single inheritance exists when a class has only one immediate (parent) superclass above it. Figure 11.10 Multiple Inheritance

28 11 Motor Vehicle And Bicycle Instance Variables Figure 11.11

29 11 Object-Oriented Concepts 4Method Overriding and Polymorphism u We may override a superclass’s method definition by redefining the method at the subclass level. (See Figure 11.12) u Polymorphism allows different objects to respond to the same message in different ways. (See Figure 11.13)

30 11 Employee Class Hierarchy Method Override Figure 11.12

31 11 Employee Class Hierarchy Polymorphism Figure 11.13

32 11 Object-Oriented Concepts 4Abstract Data Types u A data type describes a set of objects with similar characteristics. u All conventional programming languages use a set of predefined data types, known as conventional data types or base data types. u Abstract data types (ADT) describe a set of similar objects. An ADT differs from a conventional data type in that: l The ADT’s operations are user-defined. l The ADT does not allow direct access to its internal data representation or method implementation.

33 11 Object-Oriented Concepts 4Object Classification u A simple object contains only single-valued attributes and none of its attributes refer to another object. u A composite object contains at least one multivalued attribute and none of its attributes refer to another object. u A compound object contains at least one attribute that references another object. u A hybrid object contains a repeating group of attributes, and at least one of the repeating attributes refers to another object. u An associative object is used to represent a relationship between two or more objects.

34 11 Characteristics of an OO Data Model 4An Object-Oriented Data Model Must: u Support the representation of complex objects. u Be extensible; i.e., it must be capable of defining new data types as well as the operations to be performed on them. u Support encapsulation; i.e., the data representation and the method’s implementation must be hidden from external entities. u Exhibit inheritance; an object must be able to inherit the properties (data and methods) of other objects. u Support the notion of object identity (OID).

35 11 4Summary of OODM Components u The OOCM models real-world entities as objects. u Each object is composed of attributes and a set of methods. u Each attribute can reference another object or a set of objects. u The attributes and the methods implementation are hidden, or encapsulated, from other objects. u Each object is identified by a unique object ID (OID), which is independent of the value of its attributes. u Similar objects are described and grouped in a class that contains the description of the data and the method’s implementation. u The class describes a type of object. u Classes are organized in a class hierarchy. u Each object of a class inherits all properties of its superclasses in the class hierarchy. Characteristics of an OO Data Model

36 11 Comparing The OO And E-R Model Components Table 11.3


Download ppt "11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel."

Similar presentations


Ads by Google