1 / 36

Chapter 11 Object-Oriented Databases

Chapter 11 Object-Oriented Databases. Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel. Object Orientation and Its Benefits. Object orientation is a modeling and development methodology based on object-oriented (OO) concepts.

anahid
Télécharger la présentation

Chapter 11 Object-Oriented Databases

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. Object Orientation and Its Benefits • Object orientation is a modeling and development methodology based on object-oriented (OO) concepts. • Definition of Object OrientationA 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. Table 11.1 Object Orientation Contributions

  4. The Evolution of OO Concepts • From traditional to object-oriented programming (OOP) • 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. • Procedural languages (e.g., COBOL) encouraged the rigid distinction between data and procedure. • In an OOP environment, the programmer asks to perform operations on themselves. • OO concepts first appeared in some programming languages and set the stage for more refined OO concepts.

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

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

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

  8. Object-Oriented Concepts • Objects: 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. Object-Oriented Concepts • Object Identify • The object’s identity is represented by an object ID (OID), which is unique to that object. • The OID is assigned by the system at the moment of the object’s creation and cannot be changed under any circumstance. • The OID can be deleted only if the object is deleted, and that OID can never be reused.

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

  11. Object Attributes Table 11.2

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

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

  14. Depiction Of An Object Figure 11.2

  15. Object-Oriented Concepts • Messages and Methods • To invoke a method you send a message to the object. • A message is sent by specifying a receiver object, the name of the method, and any required parameters. • 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. • An object may send messages to change or interrogate another object’s state. (See Figure 11.3)

  16. Objects Send Messages To Each Other Figure 11.3

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

  18. Class Illustration Figure 11.4

  19. Representation Of The Class Student Figure 11.5

  20. Object-Oriented Concepts • Protocol • The class’s collection of messages, each identified by a message name, constitutes the object or class protocol. • The protocol represents an object’s public aspect; i.e., it is known by other objects as well as end users. • The implementation of the object’s structure and methods constitutes the object’s private aspect. • 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. Public and Private Aspects Of An Object Figure 11.6

  22. OO Summary: Object Characteristics Figure 11.7

  23. Object-Oriented Concepts • Superclasses, Subclasses, and Inheritance • Classes are organized into a class hierarchy. • 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. • Inheritance is the ability of an object within the hierarchy to inherit the data structure and behavior (methods) of the classes above it.

  24. Musical Instruments Class Hierarchy Figure 11.8

  25. Object-Oriented Concepts • Two variants of inheritance: • Single inheritance exists when a class has only one immediate superclass above it. • Most of the current OO systems support single inheritance. • 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. • 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. Single Inheritance Figure 11.9

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

  28. Motor Vehicle And Bicycle Instance Variables Figure 11.11

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

  30. Employee Class Hierarchy Method Override Figure 11.12

  31. Employee Class Hierarchy Polymorphism Figure 11.13

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

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

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

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

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

More Related