Chapter 4: Object-Oriented Data Modeling

Slides:



Advertisements
Similar presentations
Entity Relationship (E-R) Modeling Hachim Haddouti
Advertisements

Entity Relationship (ER) Modeling
Object-Oriented Analysis and Design: Object Modeling – Class Diagrams
© 2006 ITT Educational Services Inc. SE350 System Analysis for Software Engineers: Unit 9 Slide 1 Appendix 3 Object-Oriented Analysis and Design.
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall A.1.
Systems Development Life Cycle
Introduction To System Analysis and Design
Irwin/McGraw-Hill Copyright © 2004 The McGraw-Hill Companies. All Rights reserved Whitten Bentley DittmanSYSTEMS ANALYSIS AND DESIGN METHODS6th Edition.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Chapter 14 (Web): Object-Oriented Data Modeling
Object-Oriented Databases
Copyright 2004 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Second Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Appendix.
Chapter 4 Entity Relationship (E-R) Modeling
Chapter 2: Entity-Relationship Model (Continued)
Chapter 14: Object-Oriented Data Modeling
Unified Modeling Language
Advanced Information Modeling and Database Systems
Chapter 41 Enhanced Entity-Relationship and Object Modeling.
Chapter 14: Object-Oriented Data Modeling
CSE314 Database Systems Data Modeling Using the Entity- Relationship (ER) Model Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson Ed Slide Set.
Chapter 13 (Online): Object-Oriented Databases
UML Unified Modeling Language. What is UML? Unified Modeling Language (UML) is a standardized, general-purpose modeling language in the field of software.
CIT UPES | Sept 2013 | Unified Modeling Language - UML.
© 2006 ITT Educational Services Inc. SE350 System Analysis for Software Engineers: Unit 8 Slide 1 Chapter 9 Structuring System Data Requirements.
Copyright 2001 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Appendix A Object-Oriented.
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 20 Object-Oriented.
Database Management System Prepared by Dr. Ahmed El-Ragal Reviewed & Presented By Mr. Mahmoud Rafeek Alfarra College Of Science & Technology Khan younis.
Introduction To System Analysis and Design
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
© Pearson Education Limited, Chapter 7 Entity-Relationship modeling Transparencies.
CS3773 Software Engineering Lecture 04 UML Class Diagram.
CHAPTER 13 (ONLINE): OBJECT-ORIENTED DATA MODELING © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database Management 11 th Edition.
1 © Prentice Hall, 2002 Chapter 14: Object-Oriented Data Modeling Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott, Fred R.
© 2011 Pearson Education 1 Chapter 13 (Online): Object-Oriented Databases Modern Database Management 10 th Edition, International Edition Jeffrey A. Hoffer,
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 15: Object-Oriented Data Modeling Modern Database Management 9 h Edition Jeffrey A.
© 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 13 (Online): Object-Oriented Data Modeling Modern Database Management 10 th Edition.
CHAPTER 13: OBJECT-ORIENTED DATA MODELING (OVERVIEW) © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database Management 11 th Edition.
Unified Modeling Language © 2002 by Dietrich and Urban1 ADVANCED DATABASE CONCEPTS Unified Modeling Language Susan D. Urban and Suzanne W. Dietrich Department.
Chapter 9 Structuring System Data Requirements. Objectives:  Define key data modeling terms.  Draw entity-relationship (E-R) and class diagrams to represent.
Lecture 8 Object-Oriented Analysis and Design 20.1 COSC4406: Software Engineering.
Lecture 4 Conceptual Data Modeling. Objectives Define terms related to entity relationship modeling, including entity, entity instance, attribute, relationship,
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
Object-Oriented Data Modeling
UNIT_2 1 DATABASE MANAGEMENT SYSTEM[DBMS] [Unit: 2] Prepared By Lavlesh Pandit SPCE MCA, Visnagar.
Databases Illuminated Chapter 3 The Entity Relationship Model.
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
 Week08.  Review Schedule Weeks 8-14  This week o Review last class o Introduce Class Diagrams o ICE-03 Sheridan SYST Engineering Quality Systems.
Computing & Information Sciences Kansas State University Friday, 26 Sep 2008CIS 560: Database System Concepts Lecture 13 of 42 Friday, 26 September 2008.
Chapter 4 Extended Entity-Relationship (EER)Model Incorporates Set-subset Relationships Incorporates Generalization Hierarchies Constraints: Coverage Constraints:
Chapter 3: Modeling Data in the Organization. Business Rules Statements that define or constrain some aspect of the business Assert business structure.
Object-Oriented Systems. Goals Object-Oriented Methodologies – The Rumbaugh et al. OMT – The Booch methodology – Jacobson's methodologies.
CHAPTER 13: OBJECT-ORIENTED DATA MODELING (OVERVIEW) Modern Database Management 11 th Edition Jeffrey A. Hoffer, V. Ramesh, Heikki Topi © 2013 Pearson.
Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall Appendix A Object-Oriented Analysis and Design A.1.
Copyright © 2016 Pearson Education, Inc. Modern Database Management 12 th Edition Jeff Hoffer, Ramesh Venkataraman, Heikki Topi CHAPTER 2: MODELING DATA.
Department of Mathematics Computer and Information Science1 CS 351: Database Management Systems Christopher I. G. Lanclos Chapter 4.
Enhanced Entity-Relationship and UML Modeling. 2.
Entity Relationship (E-R) Model
Data Modeling Using the Entity- Relationship (ER) Model
Appendix 3 Object-Oriented Analysis and Design
Object-Oriented Modeling
Business System Development
DATA REQIREMENT ANALYSIS
Lec 3: Object-Oriented Data Modeling
Chapter 20 Object-Oriented Analysis and Design
Appendix A Object-Oriented Analysis and Design
Systems Analysis – ITEC 3155 Modeling System Requirements – Part 2
Appendix A Object-Oriented Analysis and Design
Appendix A Object-Oriented Analysis and Design
Appendix 3 Object-Oriented Analysis and Design
Presentation transcript:

Chapter 4: Object-Oriented Data Modeling Introduction UML Language Object-Oriented Modeling Object Modeling Example Tranform Class Diagram to Relational Database Schema

INTRODUCTION Object-oriented data modeling, used in conceptual design, is becoming increasingly popular because of its ability - to represent complex relationships - to represent data and data processing in a consistent notation. This data model includes many concepts similar to those used in EER model, and other modeling facilities.  An object-oriented model is built around objects, just as the ER model is built around entities. An object encapsulates both data and behavior.

This approach allows: data modeling and process modeling. Other advantages: - inheritance - code reuse Phases of object-oriented systems development cycle:        Analysis        Design        Implementation

Phases of object oriented modeling development

Benefits of object-oriented modeling  -        Ability to tackle challenging problems -        Improved communication between users, analysts, designers and programmers.  -        Increased consistency in analysis and design (*) -        Robustness of systems -        Reusability of analysis, design and programming results. 

Benefits of OO Modeling (cont.)  ERD and DFD (data flow diagram) During developing DFD, designers have to include so many irrelevant details.  There are abrupt and disjoint transitions among different notations in ER approach.    Object-Oriented approach provides a continuum of representation from analysis to design to implementation, enabling a smooth transition from one model to another.

THE UNIFIED MODELING LANGUAGE UML is a notation/ a specification language that specifies software systems. UML comes from the efforts of three notations:        Booch (1994)        OOSE (Jacobson et al.) 1992        OMT (Rumbaugh et al.) 1991  UML notation is useful for graphically depicting an object-oriented analysis or design model.  

UML (cont.) UML allows us to represent different views about a system by providing many different diagrams: -      use-case diagram -        class diagram -        state diagram -        interaction diagram -        component diagram -        deployment diagram In database conceptual design, we’ll need only class diagram to represent data and operations of a system.

OBJECT-ORIENTED DATA MODELING Representing Objects and Classes Object: An entity that has a well-defined role in the application domain as well as state, behavior and identity. -        tangible: person, place or thing -        concept or event: department, marriage, registration Objects exhibit BEHAVIOR as well as attributes.  State: attribute types and values  Behavior: how an object acts and reacts.

Behavior is expressed through operations that can be performs on it.  Identity: every object has a unique identity even if all of its attribute values are the same. For example, if there are two Student instances with identical values for all the attributes, they are still two different objects. An object maintains its own identity over its life time. Object class: a set of objects share a common structure and a common behavior.  Example: STUDENT is an object class.

Class diagram: Shows the static structure of an object-oriented model: object classes, internal structures and relationships .

Object diagram: shows instances that are compatible with a given diagram.

Operations Operation: A function or services that is provided by all instances of a class. Types of operations: -        Constructor: creates a new instance of a class. Example: create_student() -        Query: accesses the state of an object that does not alter its state. Example: get_year() -        Update: alters the state of an object. Example: promote_student() Operations implement the object’s behavior.

Associations Association: relationship among object classes. Association role: -        Role of an object in an association -        The end of an association where it connects to a class. Multiplicity -        How many objects participate in an association.  In a class diagram, a multiplicity specification is given as:   lowerbound .. upperbound

Examples: 0..* 0 ..1 1..* 1 * 2..6 1,3,5-7   Note: A binary association is bidirectional. The name of an association establishes only one direction.

Lower-bound – upper-bound Represented as: 0..1, 0..*, 1..1, 1..* Similar to minimum/maximum cardinality rules in EER

Figure 4-4 – Examples of binary association relationships (a) University example Alternative multiplicity representation: specifying the two possible values in a list instead of a range

(b) Customer order example

Representing Association Classes  An association that has attributes or operations of its own or that participates in relationships with other classes.    Like an associative entity in ER model.

Figure 4-6 – Association class and link object (a) Class diagram showing association classes Unary association with only attributes and no behavior Binary association class with behavior

Association or Class We have the option of showing the name of an association class on the association path, or the class symbol.   When an association has only attributes but does not have any operations or does not participate in other associations, we should show the name on the association path, to emphasize its “association nature”. When an association has operations of its own, we should display its name in the class rectangle to emphasize its “class nature”.

Figure 4-7 –Ternary relationship with association class

Derived Attributes, Derived Associations and Derived Roles A derived attribute, association or role is one that can be computed or derived from other attributes, associations, and roles, respectively.   A derived element is shown by placing a slash (/) before the name of the element.

Figure 4-8 – Derived attribute, association, and role Constraint expression for derived attribute Derived attribute Derived relationship (from Registers-for and Scheduled-for) Derived attributes an relationships shown with / in front of the name

Generalization/Specialization Subclass, superclass similar to subtype/supertype in EER Common attributes, relationships, AND operations Disjoint vs. Overlapping Complete (total specialization) vs. incomplete (partial specialization) Abstract Class: no direct instances Concrete Class: direct instances

Figure 4-9 – Examples of generalization, inheritance, and constraints (a) Employee superclass with three subclasses An employee can only be one of these subclasses Shared attributes and operations An employee may be none of them. Specialized attributes and operations

(a) Abstract patient class with two concrete subclasses Abstract indicated by italics A patient MUST be EXACTLY one of the subtypes Dynamic means a patient can change from one subclass to another over time

Class-level attribute  Specifies a value common to an entire class, rather than a specific value for an instance.    Represented by underlining  “=“ is initial, default value

Polymorphism Abstract Operation: Defines the form or protocol of the operation, but not its implementation. Method: The implementation of an operation. Polymorphism: The same operation may apply to two or more classes in different ways

Figure 4-11 – Polymorphism, abstract operation, class-scope attribute, and ordering This operation is abstract…it has no method at Student level Class-scope attributes – only one value common to all instances of these clases Methods are defined at subclass level

Overriding Inheritance Overriding: The process of replacing a method inherited from a superclass by a more specific implementation of that method in a subclass. For Extension: add code. For Restriction: limit the method. For Optimization: improve code by exploiting restrictions imposed by the subclass.

Figure 4-12 – Overriding inheritance Restrict job placement

Multiple Inheritance Multiple Classification: An object is an instance of more than one class. Multiple Inheritance: A class inherits features from more than one superclass.

Figure 4-13 Multiple inheritance

Aggregation Aggregation: A part-of relationship between a component object and an aggregate object. Composition: A stronger form of aggregation in which a part object belongs to only one whole object and exists only as part of the whole object. Recursive Aggregation: composition where component object is an instance of the same class as the aggregate object.

Figure 4-14 – Example aggregation

Figure 4-15 – Aggregation and Composition (a) Class diagram (b) Object diagram

Figure 4-16 – Recursive aggregation

Business Rules See chapters 3 and 4 Implicit and explicit constraints on objects – for example: cardinality constraints on association roles ordering constraints on association roles Business rules involving two graphical symbols: labeled dashed arrow from one to the other Business rules involving three or more graphical symbols: note with dashed lines to each symbol

Figure 4-17 – Representing business rules Three-symbol constraint Two-symbol constraint

Figure 4-18 – Class diagram for Pine Valley Furniture Company

OBJECT MODELING EXAMPLE: THE PINE VALLEY FURNITURE COMPANY  We do not have to put explicit identifiers for each class since each object will have its own object identity. ER model and relational model use value-based identification (Explicit identification) OO model uses existence-based identification (Implicit identification) In OO model, the identifiers that we should create are the identifier attributes that are meaningful in the application. Example: Salesperson_ID, Customer_ID, …

And we should not create the identifiers that are not meaningful attributes in real life. Example: ProductLine_ID, Vendor_ID, Skill_ID   Note: In a conceptual object-oriented model, an attribute should be single-valued. Therefore, a multivalued attribute should be transformed into a separate class and an 1:N association between the class and the new class.

TRANSFORM CLASS DIAGRAM TO RELATIONAL DATABASE SCHEMA In general, the transformation of class diagram to relational schema is similar to that of EER to relational schema, except some specific issues. 1.  Transform a class in class diagram to a table 2.  Transform an attribute of a class to a table column. 3.  In case a class does not have any explicit identifier, create a primary key (usually of integer type) for the table corresponding to that class. 4.  For a table corresponding to a subclass, use the primary key of its superclass as its primary key.

5.  For a table corresponding to an association class, create a primary key for it. Besides, put primary keys of the tables corresponding to the participant classes as its foreign keys.  6.  For a component class in an aggregate association, its table takes primary key of the table corresponding to its aggregate class as a part of its primary key.  7.  Transforming a binary or ternary association into a relational schema strongly resembles the transformation of the EER relationship.  8.  Represent the operations of a class as stored procedures or functions. These functions/ procedures may contains some SQL commands. 9.  There is no good way to represent multiple inheritance in a relational schema. Restructure the class diagram to avoid it.