Top Banner
Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012
39

Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

Jan 03, 2016

Download

Documents

Rodney McGee
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

Pratt & Adamski chapter 9&

Some extra material

The Object-Oriented approachObject-Oriented DBMSsSemantic Object Models

Spring 2012

Page 2: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

Overview

• Object-Oriented Systems

• Class Diagrams

• Unified Modeling Language (UML)

• Object-Oriented DBMS

• Semantic Object Models (SOM)

Page 3: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

Object-Oriented Systems

• View the world in terms of objects ("things") • Easier to think of systems as objects (customer,

shipping clerk,,) • main driver: reusability

Object-orientation appears as: • Object-oriented user interfaces (90% of new projects)

• Object-oriented programming (80% of new projects)

• Object-oriented databases (5% or less)

• OO analysis and design (30 to 40%)

Page 4: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

Objects: Key Concepts

Definition: Objects are data guarded by a protective layer of code. OO Software components consist of variables and methods

Key concepts of the object-oriented paradigm: • object• attributes of objects• methods of object show behavior (what it can

provide )• class : template of objects

• inheritance (lower level objects can inherit from higher level)

Page 5: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

Objects: Key Concepts

Key Concepts (continued):

-Modularity (reduce complex systems into highly cohesive but loosely coupled modules)

-Encapsulation (Information hiding in implementation)

MessageObjects communicate via message passing. A message consists of an object (the recipient), a method, and optional parameters.

Page 6: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

Object Examples

Example: items in a department store.

TV is an object. The attributes of this object are model, year, cost,

etc.The methods, for store are, purchase, repair

Radio is another object, so is a dishwasher • many of these objects have similar properties

(attributes, methods) • can define a hierarchy .

Page 7: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

Object Examples

A Customer object is customer data and customer methodsThe attributes of customer object are Name, Address, Account No, Balance DueThe methods on the customer object are Send-Invoice, Add-Customer, etc.

Customer

NameAddressAccount NoBalance Due

Add-Customer()Update-Customer()Get-Balance-Due()Send-Invoice()

Smith: Customer

-Smith-1109 Main St.-1100987546-$589.19

Add-Customer()Update-Customer()Get-Balance-Due()Send-Invoice()

Class Object

Page 8: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

Unified Modeling Language (UML)

Unified Modeling Language (UML)Original version released in 1996Became an International Standard in 1997 with the

formation of UML Partners (HP, IBM, Microsoft, Oracle, Rational Software)

A graphical language for Object-Oriented Analysis and Design (OOAD)

Manage Resources

Manage Projects

Project Manager

Resource Manager

Use Case Diagram Class Diagram

Resource

Salaried Hourly

Sequence Diagram

Page 9: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

Unified Modeling Language (UML)

1. Use Case Diagram2. Class Diagrams3. Object Diagrams4. Sequence Diagrams5. Collaboration Diagrams6. Statechart Diagrams7. Activity Diagrams8. Component Diagrams9. Deployment Diagrams

Unified Modeling Language (UML)

Page 10: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

Use-cases

Use cases describe the functionality of the system from the user point of view.

Each use case provides one or more scenarios of how the system should interact with the users called actors

Use cases are written in non-technical language, understood by users

Use cases are written as a part of requirement analysis. Use cases are separate and distinct from use case diagrams, which

allow one to abstractly work with groups of use cases. Use case diagrams are created after the use case descriptions are

written.

Source: Dr. Sidorova, UNT

Page 11: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

Use Cases DiagramsDepiction of a system’s behavior or functionality under various conditions as the system responds to requests from users

Actor

Use-case

System boundary

Association (connection)

Include relationship

Extend relationship

Generalization relationship

StudentUseCase1

<<include>>

<<extend>>

Source: Dr. Sidorova, UNT

Page 12: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

Example of a use case

diagram from

Wikepidea

Source: Dr. Sidorova, UNT

Page 13: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

Class: Key Concepts

ClassA template or prototype that defines the composition and the behavior of all objects of certain kinds. These objects are called instances of the class

InheritanceA mechanism to organize classes by commonalities.

subclasses, specialization superclass, generalization Example:

Student GradStudent MSStudent PhDStudent UGStudent

Page 14: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

Class diagrams

A class: point An object: p1

Attributes or fields: int x, y;

A method: point move(int dx, int dy)

A message: p2 = p1.move(10, 10)

Point

xy

Move

Fields (attributes)

Class name

methods

p1: Point

x = 0y = 0

p2: Point

x = 10y = 10

Page 15: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

• Name of class

• Attributes

• Data types

• Methods (operations)

• Association (relationship)

• Multiplicity (cardinality)

Class Diagram details

Page 16: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

Class Diagram details

• Associations are shown as lines joining classes and represent relationships. Multiplicity indicates the number of objects at the end of the relationship. Example: 1..1, 0..n, 1..n.

• The visibility symbol indicates whether other classes can view or update attribute values:– Public visibility (+), any other class can view/update– Protected visibility (#), class itself or its subclasses

can view/update– Private visibility (-), only class itself can view/update

Page 17: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

Class Diagram for Premiere ProductsFigure 9.24

Page 18: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

Class Diagram with ConstraintsFigure 9.25

Page 19: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

Class Diagram with a Generalization and a Constraint

Figure 9.26

Page 20: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

Object-Oriented DBMS (OODBMS)

• System in which data and the methods operating on that data are encapsulated into objects

• Store graphics, drawings, video, sound, and other complex objects called binary large objects (BLOBs)

• General concepts– Objects and classes– Methods and messages– Inheritance

Page 21: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

Rules for OODBMSs: what they should support

1. Complex Objects2. Object Identity3. Encapsulation4. Information Hiding5. Types (classes)6. Inheritance7. Late Binding (polymorphism)8. Computational Completeness9. Extensibility10. Persistence11. Performance12. Concurrent Update support13. Recovery support14. Query facilities

Page 22: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

Semantic Object Model (SOM):a different approach

Page 23: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

S-O MODEL CHARACTERISTICS

• S-O Model More Bottom-Up-Oriented than the E-R Model

• Both Are a Type of "Pseudo-Code“ or "Flowchart" Tool For DB Design

• David Kroenke primary developer of the SO Model (1994).– The Model Is Robust But Lacks Standards.– NOT Widely Used Yet in CASE Tools.

Page 24: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

S-O MODEL DEFINITIONS

1. * Semantic Object

2. * Object Identifier (primary key)

3. * Object Properties or Attributes

4. * Semantic Object Links

5. * Formulas

Page 25: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

S-O MODEL DEFINITIONS• * Semantic Objects -- Represented by a

Rectangle (See Fig B.2.a)– A named collection of Properties that

sufficiently describes a distinct entity (Things, Objects (Nouns) Of Importance To The Users' Data Model)

– E.g., Employee, Customer, Inventory, Order, Etc.

• Instance Of A Semantic Object (Fig B.3)– Professor “Nick Evangelopoulos”

• Semantic Object Classes --– Collections Of Same Types Of Objects

Page 26: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

Object Diagram Fig. B.2

Page 27: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

Figure B.3Instance of a Semantic Object

Page 28: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

S-O MODEL DEFINITIONS• * Semantic Objects are Distinct Entities --

– There are NO “weak” semantic objects!– Consider the relational DB design of an ordering

system: Line_Item would be property of ORDER, not a distinct entity.

– Semantic Objects are ALWAYS independent!!– Names in CAPITAL letters

• Semantic Objects:• Must Exist In The Minds Of The Users--• This is Why They Are Called Semantic Objects

Page 29: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

S-O MODEL DEFINITIONS

• Object Identifier:– Identifies A Unique Object Instance (Key)– May Be a Group or Composite

(concatenated) Key (OrderNum, LineNum), (Cust_Name, Cust_Addr)

– ID NameMixedCase– ID UniqueId when underlined

Page 30: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

S-O MODEL DEFINITIONS

• * Properties (Or Attributes) -- Fig B.2 Characteristics Of Semantic Objects:– Simple Data Values (S)– Multi-Valued (MV or 1.N)– Composite or Group Attributes (G)– Object attributes or Semantic Object Links (SOLs);

• (see below)• Paired attributes: If an object contains another object, the

second object will contain the first [SOLs are reciprocal]

– USE Mixed Case for Naming Convention: DeptId

Page 31: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

Figure B.2 (b)Cardinalities (Min.Max)

Page 32: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

S-O MODEL DEFINITIONS

• * Semantic Object Link (SOL) – Special Type of Property– Recursiveness– Represented by a rectangle inside of the SO

• * Formulas (F)– Formula Functions: SUM, COUNT, MIN, MAX,

AVG– Formula Expressions: e.g., Salary / 12

Page 33: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

Figure B.2 (a) & (b) SOLs

Page 34: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

S-O MODEL DEFINITIONS (Misc..)

• Property Domains– Set Of All Possible Values Of A Property

• Semantic Object Views (Fig. B.4)– Subset Of Properties Of S-O Required By A

Particular Application Or User. Synthesis Of Multiple Objects

– Views Required To Build Complete Object Diagram.

Page 35: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

Figure B.4Semantic Object View

Page 36: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

S-O DIAGRAMS Guidelines

• Picture Of User’s Defined Objects – Non-Standard notation

• Rectangles for Objects; NAMES in Capital letters inside rectangle

• Object Properties written in MixedCase

• SOLinks -- Written in Capital letters inside their own rectangles within the SO

• Groups (Composites) properties are bracketed or braced on Right-hand side

Page 37: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

S-O DIAGRAMS Guidelines (continued)

• Multi-valued property Cardinalities are shown as Subscripts:– 1.1, 1.N, 0.1, 0.N, etc. (also, MV)– Actually Minimum and Maximum Cardinality

for each property (ID, S, G, or SOL)• Min.Max The minimum and maximum allowable

occurrences for each property. • 0.1 means that the property may have no

instances, but at most 1.• 1.N means that the property must have at least

one instance, and could have many instances.

Page 38: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

Figure B.2 (b)Cardinalities (Min.Max)

Page 39: Pratt & Adamski chapter 9 & Some extra material The Object-Oriented approach Object-Oriented DBMSs Semantic Object Models Spring 2012.

Summary

• Object-Oriented Systems

• Class Diagrams

• Unified Modeling Language (UML)

• Object-Oriented DBMS

• Semantic Object Models (SOM)