pratt & adamski chapter 9 & some extra material the object-oriented approach object-oriented...

Post on 03-Jan-2016

223 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Pratt & Adamski chapter 9&

Some extra material

The Object-Oriented approachObject-Oriented DBMSsSemantic Object Models

Spring 2012

Overview

• Object-Oriented Systems

• Class Diagrams

• Unified Modeling Language (UML)

• Object-Oriented DBMS

• Semantic Object Models (SOM)

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%)

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)

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.

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 .

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

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

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)

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

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

Example of a use case

diagram from

Wikepidea

Source: Dr. Sidorova, UNT

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

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

• Name of class

• Attributes

• Data types

• Methods (operations)

• Association (relationship)

• Multiplicity (cardinality)

Class Diagram details

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

Class Diagram for Premiere ProductsFigure 9.24

Class Diagram with ConstraintsFigure 9.25

Class Diagram with a Generalization and a Constraint

Figure 9.26

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

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

Semantic Object Model (SOM):a different approach

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.

S-O MODEL DEFINITIONS

1. * Semantic Object

2. * Object Identifier (primary key)

3. * Object Properties or Attributes

4. * Semantic Object Links

5. * Formulas

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

Object Diagram Fig. B.2

Figure B.3Instance of a Semantic Object

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

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

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

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

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

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

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.

Figure B.4Semantic Object View

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

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.

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

Summary

• Object-Oriented Systems

• Class Diagrams

• Unified Modeling Language (UML)

• Object-Oriented DBMS

• Semantic Object Models (SOM)

top related