Unified Modeling Language (UML)

Similar documents
Chapter 2 Entity-Relationship Data Modeling: Tools and Techniques. Fundamentals, Design, and Implementation, 9/e

Chapter 2 Entity-Relationship Data Modeling: Tools and Techniques. Fundamentals, Design, and Implementation, 9/e

Database Systems: Design, Implementation, and Management Tenth Edition. Chapter 4 Entity Relationship (ER) Modeling

Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition. Chapter 7 Data Modeling with Entity Relationship Diagrams

Database Systems: Design, Implementation, and Management Tenth Edition. Chapter 4 Entity Relationship (ER) Modeling

Copyright 2016 Ramez Elmasr and Shamkant B. Navathei

S T R U C T U R A L M O D E L I N G ( M O D E L I N G A S Y S T E M ' S L O G I C A L S T R U C T U R E U S I N G C L A S S E S A N D C L A S S D I A

E-R Model. Hi! Here in this lecture we are going to discuss about the E-R Model.

More on the Chen Notation

Object Oriented Modeling

Unified Modeling Language (UML) and Modeling

Non-overlappingoverlapping. Final outcome of the worked example On pages R&C pages R&C page 157 Fig 3.52

Overview of Database Design Process. Data Modeling Using the Entity- Relationship (ER) Model. Two main activities:

Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition. Chapter 8 Data Modeling Advanced Concepts

Comparison of ER Modeling Notations

Software Engineering Lab Manual

Entity Relationship Modeling. From Rob and Coronel (2004), Database Systems: Design, Implementation, and Management

A l Ain University Of Science and Technology

UML Primer. -Elango Sundaram

Chapter 6. Advanced Data Modeling. Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel

Chapter 8: Enhanced ER Model

MTAT Introduction to Databases

Metamodeling. Janos Sztipanovits ISIS, Vanderbilt University

CMP-3440 Database Systems

Modeling with UML. (1) Use Case Diagram. (2) Class Diagram. (3) Interaction Diagram. (4) State Diagram

Chapter 17. Methodology Logical Database Design for the Relational Model

A l Ain University Of Science and Technology

DATABASE SYSTEMS. Chapter 5 Entity Relationship (ER) Modelling DESIGN IMPLEMENTATION AND MANAGEMENT INTERNATIONAL EDITION ROB CORONEL CROCKETT

Database Systems. A Practical Approach to Design, Implementation, and Management. Database Systems. Thomas Connolly Carolyn Begg

Chapter Outline. Note 1. Overview of Database Design Process Example Database Application (COMPANY) ER Model Concepts

Object-Oriented Systems Analysis and Design Using UML

Chapter 4. In this chapter, you will learn:

Fundamentals, Design, and Implementation, 9/e Copyright 2004 Database Processing: Fundamentals, Design, and Implementation, 9/e by David M.

COSC 3351 Software Design. An Introduction to UML (I)

ER to Relational Mapping

CHAPTER 1. Topic: UML Overview. CHAPTER 1: Topic 1. Topic: UML Overview

Unified Modeling Language (UML) Class Diagram

Experiment no 4 Study of Class Diagram in Rational Rose

ER Modeling ER Diagram ID-Dependent and Weak Entities Pg 1

Module 2 : Entity-Relationship Model 15

Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model

David M. Kroenke and David J. Auer Database Processing Fundamentals, Design, and Implementation

Review -Chapter 4. Review -Chapter 5

Chapter 10. Object-Oriented Analysis and Modeling Using the UML. McGraw-Hill/Irwin

An Introduction To Object Modeling System Concept for Object Modeling The Overall View Components of UML Diagram

Object Modeling. Entity-Relationship (ER) diagrams (1976) Object Modelling Technique (OMT) diagrams (1991)

OO Techniques & UML Class Diagrams

A COMPARATIVE ANALYSIS TO VALIDATE THE BENIFITS OF FORMAL VERSUS INFORMAL SOFTWARE MODEL TRANSFORMATION

Modeling Databases Using UML

2. An implementation-ready data model needn't necessarily contain enforceable rules to guarantee the integrity of the data.

Chapter # 4 Entity Relationship (ER) Modeling

Introducing the UML Eng. Mohammed T. Abo Alroos

Chapter 2: Entity-Relationship Model

Chapter 4 Entity Relationship Modeling In this chapter, you will learn:

Data Modeling Using the Entity-Relationship (ER) Model

Notation Part 1. Object Orientated Analysis and Design. Benjamin Kenwright

Topic 3 Unified Modeling Language UML. Objective: Student will use UML to represent relationshiops between objects, its structure and dynamics.

Use of UML in Tranmodel

Entity-Relationship Model. From Chapter 5, Kroenke book

UML Tutorial. Unified Modeling Language UML Tutorial

II. Data Models. Importance of Data Models. Entity Set (and its attributes) Data Modeling and Data Models. Data Model Basic Building Blocks

COMP 244. ER-Diagram Notations. Entity-Relationship Diagrams DATABASE CONCEPTS & APPLICATIONS. Database Concepts & Applications 1.

CHAPTER 2: DATA MODELS

Using High-Level Conceptual Data Models for Database Design A Sample Database Application Entity Types, Entity Sets, Attributes, and Keys

CS 405G: Introduction to Database Systems

Intro to DB CHAPTER 6

Chapter 3 Database Modeling and Design II. Database Modeling

Introduction to Software Engineering. 5. Modeling Objects and Classes

The DBMS accepts requests for data from the application program and instructs the operating system to transfer the appropriate data.

Comparative analyses for the performance of Rational Rose and Visio in software engineering teaching

Information Technology Audit & Cyber Security

DATABASE SYSTEMS CHAPTER 2 DATA MODELS 1 DESIGN IMPLEMENTATION AND MANAGEMENT INTERNATIONAL EDITION ROB CORONEL CROCKETT

CSC 261/461 Database Systems Lecture 8. Spring 2018

LABORATORY 1 REVISION

Oracle Data Modeling and Relational Database Design

Relational Model (cont d) & Entity Relational Model. Lecture 2

High Level Database Models

4. Entity Relationship Model

UML diagrams. Software artifacts include: SRS, SDS, test cases, source code, technical/user manual, software architecture, etc.

The entity is an object of interest to the end user. entity correspond to the table not to a row- in the relational environment.

Conceptual Data Modeling and the Entity- Relationship Model. Department of Computer Science Northern Illinois University September 2014

Credit where Credit is Due. Lecture 4: Fundamentals of Object Technology. Goals for this Lecture. Real-World Objects

Overview of Database Design Process Example Database Application (COMPANY) ER Model Concepts

Enhanced Entity-Relationship (EER) Modeling

Full file at Chapter 2: Foundation Concepts

LELCTURE 4: ENHANCED ENTITY-RELATIONSHIP MODELING (EER)

COMP 244 DATABASE CONCEPTS & APPLICATIONS

UML UNIFIED MODELLING LANGUAGE EXEMPLIFIED ON BLACKJACK. Object Oriented Programming (Samy Zafrany)

Object-Oriented Software Engineering Practical Software Development using UML and Java

8) A top-to-bottom relationship among the items in a database is established by a

Chapter 8 The Enhanced Entity- Relationship (EER) Model

Database Design. IIO30100 Tietokantojen suunnittelu. Michal Zabovsky. Presentation overview

Today s Topic. Lecture 5. What is UML? Why Use UML. UML Diagrams. Introduction to UML. What is UML Why use UML? UML Diagrams

Objectives of logical design... Transforming the ERD diagram into relations. Relational database components. Mapping a composite attribute

Data and Process Modelling

Handout 4. Logical Database Modeling, Part 1: Relational Data Model. Transforming EER model to Relational.


Fundamentals of Design, Implementation, and Management Tenth Edition

CHAPTER 2: DATA MODELS

Database Design CENG 351

Transcription:

Appendix H Unified Modeling Language (UML) Preview The Unified Modeling Language (UML) is an object-oriented modeling language sponsored by the Object Management Group (OMG) and published as a standard in 1997. UML is the result of an effort headed by the OMG to develop a common set of objectoriented diagrams and notations (symbols and constructs) for the analysis, design, and modeling of systems. Because the origin of UML is closely related to the object-oriented concepts you explored in Appendix G, Object-Oriented Databases, object terminology is used throughout this section. Keep in mind that UML is not a methodology or procedure for developing databases. Rather, UML is a language that describes a set of diagrams and symbols that can be used to model a system graphically. UML diagrams encompass static data components (classes and their associations) and components such as business processes, data flows, and hardware. Table H.1 shows the nine different types of diagrams that the UML standard offers. Data Files and Available Formats MS Access Oracle MS SQL My SQL There are no data files for this appendix. Data Files Available on cengagebrain.com MS Access Oracle MS SQL My SQL

H-2 Appendix H TABLE H.1 UML DIAGRAMS DIAGRAM NAME Activity diagram Class diagram Collaboration diagram Component diagram Deployment diagram Sequence diagram State diagram Object diagram Use Case diagram Note USAGE Describes the behavior of a system. Very similar to data flow diagrams that model specific business processes. Related to Use Case diagrams. Describes the static components of object classes. (Remember, a class is a collection of similar objects.) Similar in function to an ER diagram in a relational database modeling. Describes the interaction between objects in a system messages sent among objects, parameters passed, actions taken, and so on. An alternative to the Sequence diagram. Describes the arrangement of software components that form a system and the way those components interact. Describes the arrangement of hardware components within a system. Describes what objects run in each component. Describes the interaction between objects in a system (what messages are invoked and in what order). Very similar to Collaboration diagrams and related to Use Case diagrams. Describes the object s state during object interactions. Models the changes in an object s state during its interactions with other objects. Describes the static nature of object instances within a system at a given point in time. Describes business processes within a system. Very similar to data flow diagrams. Because the main focus here is on database design, not all of the different types of diagrams that UML offers are covered. Instead, the content focuses on the use of Class diagrams to model the static data components (object classes and their relationships) that are part of a database system. H-1 Using Class Diagrams to Model Database Tables The UML Class diagram is the equivalent of the ER diagram in the relational model. The Class diagram is used to model object classes and their associations. Because an object class is a collection of similar objects, a class is the equivalent of an entity set in the ER model. Therefore, a class is described by its attributes and by its methods. MS Visio Professional has been used to develop the examples shown in this appendix. To create Class diagrams in MS Visio Professional, from the menu select File, New, Software, UML Model Diagram, UML Static Structure. The sequence is illustrated in Figure H.1. H-1a Classes to Represent Entity Sets In a UML Class diagram, a class is represented by a box that is subdivided into three parts. 1. The top part is used to name the class. 2. The middle part is used to name and describe the class attributes. (A class attribute is identified by a name and a data type.)

3. The bottom part is used to list the class methods. Both the attributes and the methods are displayed. Unified Modeling Language (UML) H-3 FIGURE H.1 CREATING CLASS DIAGRAMS IN VISIO: STARTING THE PROCESS The three parts are illustrated in Figure H.2. FIGURE H.2 UML REPRESENTATION OF THE CUSTOMER CLASS Visibility: + Public # Protected Private Class name Class attributes Class methods UML diagram types As you can see in Figure H.2, the UML representation of a class is very similar to the ER representation of an entity, but there are some important differences. A class box also lists the methods of the class in the bottom part of the box. A + symbol is placed before attributes and methods. The + symbol indicates the visibility of the UML element.

H-4 Appendix H H-1b Visibility The visibility concept is derived from object-oriented programming. Visibility describes the availability of an object attribute or method to other objects or methods. Visibility characteristics are summarized in Table H.2. TABLE H.2 ATTRIBUTE AND METHOD VISIBILITY Attribute Method PUBLIC (+) PROTECTED (#) PRIVATE (-) The attribute is available for read/write purposes to any method of any class. The method can be invoked by any method of any class. The attribute is available for read/write purposes only to the methods of the class and its subclasses. The method can be invoked only by the methods of the class and its subclasses. The attribute is available only to the methods of the class. The method is available only to the methods of the class. H-2 Associations to Represent Relationships The UML Class diagram represents relationships as associations among objects. (An object is an instance of a class.) Because associations among classes are critical for database design purposes, you begin by studying how the UML Class diagram represents 1:M associations. H-2a Representing 1:M Associations Figure H.3 shows a UML Class diagram with two 1:M relationships: a CUSTOMER generates many INVOICEs, and a VENDOR provides many PRODUCTs. FIGURE H.3 REPRESENTING 1:M RELATIONSHIPS WITH CLASS DIAGRAMS Roles Multiplicity

Unified Modeling Language (UML) H-5 Note UML Class diagrams do not require the foreign key attribute to be added to the many side of the 1:M relationship. The object-oriented model implements class associations through the use of object IDs, which are internally managed by the OODBMS. (See Appendix G.) However, because the focus here is on the use of UML Class diagrams to model relational databases, the foreign key attributes are shown in the class diagrams. By examining Figure H.3, you can see that associations are represented by lines that connect the classes. Associations have several characteristics. Association name. Each association has a name. Normally, the name of the association is written over the association line. In the example, the association name is not shown; instead, role names are used. Role name. The participating classes in the relationship can also have role names. A role name expresses the role played by a given class in the relationship. In Figure H.3, the role names represent the relationship as seen by each class; for example: A CUSTOMER generates an INVOICE, and each INVOICE belongs to a CUSTOMER. A VENDOR supplies a PRODUCT, and each PRODUCT is supplied by a VENDOR. Association direction. Associations also have a direction, represented by an arrow ( ) pointing to the direction in which the relationship flows. (Relationship direction is not displayed in Figure H.3.) Multiplicity. Multiplicity refers to the number of instances of one class that are associated with one instance of a related class. Multiplicity in the UML model provides the same information as the connectivity, cardinality, and relationship participation constructs in the ER model. For example: One (and only one) CUSTOMER generates zero to many INVOICEs, and one INVOICE belongs to one and only one CUSTOMER. One (and only one) VENDOR supplies zero to many PRODUCTs, and one PROD- UCT is supplied by one and only one VENDOR. Table H.3 shows the different multiplicity values that can be used. TABLE H.3 MULTIPLICITY MULTIPLICITY DESCRIPTION 0..1 A minimum of zero and a maximum of one instance of this class are associated with an instance of the other related class (indicates an optional class). 0..* A minimum of zero and a maximum of many instances of this class are associated with an instance of the other related class (indicates an optional class). 1..1 A minimum of one and a maximum of one instance of this class are associated with an instance of the other related class (indicates a mandatory class). 1..* A minimum of one and a maximum of many instances of this class are associated with an instance of the other related class (indicates a mandatory class). 1 Exactly one instance of this class is associated with an instance of the other related class (indicates a mandatory class). * Many instances of this class are associated with an instance of the other related class.

H-6 Appendix H The multiplicity symbols implicitly describe the relationship participation concept used in the ER model. For example, a 1..1 multiplicity on the CUSTOMER side indicates a mandatory participation. A 0..* multiplicity on the INVOICE side indicates an optional participation. If you examine Figure H.3, you will note that the visibility of the foreign key attributes CUS_CODE and V_CODE have been defined as private (-). Although there is no requirement to specify the foreign key attributes in the UML class diagram, this option has been chosen to highlight the use of the visibility property within the attributes of a class. H-2b Representing M:N Associations UML Class diagrams can use the multiplicity element to represent M:N relationships directly. For example, Figure H.4 shows the following two examples of M:N associations: A STUDENT enrolls in many CLASSes, and each CLASS is taken by many STUDENTs. An INVOICE contains many PRODUCTs, and each PRODUCT is sold in many INVOICEs. FIGURE H.4 M:N ASSOCIATIONS IN A UML CLASS DIAGRAM If you examine Figure H.4, you will see that the M:N association between STUDENT and CLASS is optional at both ends. (The optionality is represented by the 0..* multiplicity.) However, the M:N association between INVOICE and PRODUCT exhibits two different multiplicity values. The 1..* multiplicity at the PRODUCT end indicates that an INVOICE contains a minimum of one and a maximum of many PRODUCT instances. The 0..* multiplicity at the INVOICE end indicates that a PRODUCT is sold in a minimum of zero and a maximum of many INVOICE instances. In the UML diagram, the multiplicity value always refers to the class to which that value is attached. That is, you always try to find out how many instances of a class are associated to one instance of another class. Contrast that to the use of role names, which are always close to the class that plays the role.

Unified Modeling Language (UML) H-7 H-2c Association Class An association class is used to represent a M:N association between two classes. The association class exists within the context of the associated objects, and as in the ER model, the association class can have its own attributes. Figure H.5 shows the use of a LINE association class to represent the M:N relationship between INVOICE and PRODUCT. FIGURE H.5 ASSOCIATION CLASS REPRESENTATION H-2d Composition and Aggregation The UML Class diagram uses symbols to indicate the strength of the association between two class instances. In particular, the UML Class diagram uses aggregation and composition to indicate the strength of dependency between two classes participating in an association. Table H.4 summarizes the main characteristics of the aggregation and composition UML constructs. TABLE H.4 AGGREGATIONS AND COMPOSITIONS UML CONSTRUCT UML DESCRIPTION SYMBOL Aggregation This type of association represents a has a type of relationship (that is, an object that is formed as a collection of other objects). An aggregation indicates that the dependent (child) object instance has an optional association with the strong (parent) object instance. When the parent object instance is deleted, the child object instances are not deleted. The aggregation association is represented by an empty diamond in the side of the parent entity. Composition This type of association represents a special case of the aggregation association. A composition indicates that a dependent (child) object instance has a mandatory association with a strong (parent) object instance. When the parent object instance is deleted, all child object instances are automatically deleted. The composition association is represented with a filled diamond in the side of the parent object instance. This is the equivalent of a weak entity in the ER model.

H-8 Appendix H Examine the relationships depicted in Figure H.6 to help you understand the use of aggregation and composition. FIGURE H.6 AGGREGATION AND COMPOSITION EXAMPLES Aggregation Deleting an OWNER parent instance does not delete all related CAR children instances. Composition Deleting an INVOICE parent instance deletes all related LINE children instances. The UML standard guides the use of the aggregation and composition constructs as follows: An aggregation construct is used when an object is composed of (or is formed by) a collection of other objects, but the objects are independent of each other. That is, the relationship can be classified as a has a relationship type. For example, an owner owns many cars, a team has many players, or a band has many musicians. A composition construct is used when two objects are associated in an aggregation association with a strong identifying relationship. That is, deleting the parent deletes the children instances. For example, an invoice contains invoice lines, an order contains order lines, or an employee has dependents. The use of a composition construct implies the use of the CASCADE DELETE foreign key rule in the relational database model. H-3 Generalizations to Represent Supertypes and Subtype The UML diagram also enables you to represent class generalization hierarchies in which a class is a subtype of another (supertype) class. You learned about those classification types in Chapter 4, Entity Relationship (ER) Modeling, and in Appendix G. Figure H.7 shows an example of a UML generalization hierarchy.

Unified Modeling Language (UML) H-9 FIGURE H.7 GENERALIZATION EXAMPLE The generalization hierarchy is represented by an arrow that points to the parent class. Figure H.7 shows an EMPLOYEE class supertype with three class subtypes: PILOT, MECHANIC, and ACCOUNTANT. In this case, the class hierarchy represents disjoint subtypes; that is, one employee can be related to only one subtype class (a pilot or a mechanic or an accountant). Generalizations can also have constraints. The job_type label next to the generalization line indicates the EMPLOYEE attribute that was used to determine to which class subtype the instance belongs. H-4 UML and the Relational Model This brief tutorial has examined the use of the Unified Modeling Language (UML) Class diagram as a database design option. The main focus of UML notation is to facilitate the analysis, design, and implementation of computerized database solutions. To accomplish that task, UML uses a set of diagramming notations derived from object-oriented concepts and, in particular, object-oriented programming. Several points are worth emphasizing. UML is not a design methodology. It is best described as a design notation. UML notation is not geared specifically toward data modeling or relational database design. On the contrary, UML focuses on supporting the process of analyzing and designing information systems. One of UML s main characteristics is that it is extensible, thus enabling the designer to create new constructs through the use of so-called stereotypes. As used in the context of UML, a stereotype is a new element that represents a distinctive object, characteristic, or functionality in the model. For example, a designer can add new stereotypes to represent primary keys, foreign keys, indexes, triggers, stored procedures, views, and so on. UML is becoming common in systems analysis and design, but not in database design, where relational database modeling tools such as Microsoft s Visio Professional, Computer Associates ERwin Data Modeler, or Embarcadero s ER/Studio are the norm. Because the relational model is still the dominant data model, the adoption of a relational

H-10 Appendix H data modeling notation within UML would help to increase its penetration in the design and modeling market. If such a merger took place, database designers and system analysts would be able to use the same set of design tools, thus facilitating the creation of information systems. The extensibility of UML is the characteristic that opens the door for UML to directly support relational database modeling notation. For example, as of this writing, IBM offers its Rational Rose Professional Data Modeler product, which introduces a Data Modeling Profile for UML. This tool allows database designers to create semantically rich relational database models with support for all relational constructs, such as primary keys, foreign keys, indexes, triggers, and stored procedures. Although the Data Modeling Profile is not yet a UML standard, it is backed by IBM, an active member of the OMG consortium. So this merger of concepts and tools could yield the best of both worlds.