Understanding Advanced UML Concepts Gerd Wagner

Slides:



Advertisements
Similar presentations
Chapter 6: Entity-Relationship Model (part I)
Advertisements

Entity-Relationship (ER) Modeling
Chapter 3 Data Modeling Copyright © 2014 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent.
Systems Development Life Cycle
Text-Book Chapters (7 and 8) Entity-Relationship Model
CS 340 UML Class Diagrams. A model is an abstraction of a system, specifying the modeled system from a certain viewpoint and at a certain level of abstraction.
UML Class Diagram. UML Class Diagrams2 Agenda What is a Class Diagram? Essential Elements of a UML Class Diagram Tips.
Lecturer: Sebastian Coope Ashton Building, Room G.18 COMP 201 web-page: Lecture.
CS157A Lecture 3 ER Diagram Prof. Sin-Min Lee Department of Computer Science San Jose State University.
UML Class Diagram and Packages Written by Zvika Gutterman Adam Carmi.
Modeling Data The Entity Relationship Model (ER) For Database Design.
7M701 1 Class Diagram advanced concepts. 7M701 2 Characteristics of Object Oriented Design (OOD) objectData and operations (functions) are combined 
Chapter 3: Modeling Data in the Organization
Slides adapted from A. Silberschatz et al. Database System Concepts, 5th Ed. Entity-Relationship Model Database Management Systems I Alex Coman, Winter.
Chapter 2: Entity-Relationship Model (Continued)
Entity-Relationship (E-R) Model
Chapter 3 © 2005 by Prentice Hall 1 Objectives Definition of terms Definition of terms Importance of data modeling Importance of data modeling Write good.
UML Class Diagrams: Basic Concepts. Objects –The purpose of class modeling is to describe objects. –An object is a concept, abstraction or thing that.
Object-Oriented Analysis and Design
Chapter 41 Enhanced Entity-Relationship and Object Modeling.
1 Web-Enabled Decision Support Systems Entity-Relationship Modeling Prof. Name Position (123) University Name.
the Entity-Relationship Model
ICOM 5016 – Introduction to Database Systems Lecture 4 Dr. Manuel Rodriguez Department of Electrical and Computer Engineering University of Puerto Rico,
UML Unified Modeling Language. What is UML? Unified Modeling Language (UML) is a standardized, general-purpose modeling language in the field of software.
Database System Concepts, 5th Ed. Chapter 6: Entity-Relationship Model.
Entity-Relationship Model
1 ER Modeling BUAD/American University Entity Relationship (ER) Modeling.
Entity Relationship Modeling
Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model.
R McFadyen Chapter 7 Conceptual Data Modeling.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
CS3773 Software Engineering Lecture 04 UML Class Diagram.
7-1 © Prentice Hall, 2004 Chapter 7: Conceptual Data Modeling Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich,
7-1 © Prentice Hall, 2007 Chapter 7: Conceptual Data Modeling Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich,
Unit 3 Conceptual Data Modeling. Key Concepts Conceptual data modeling process Classes and objects Attributes Identifiers, candidate keys, and primary.
7-1 © Prentice Hall, 2007 Week 5: Conceptual Data Modeling Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich,
Unified Modeling Language © 2002 by Dietrich and Urban1 ADVANCED DATABASE CONCEPTS Unified Modeling Language Susan D. Urban and Suzanne W. Dietrich Department.
® IBM Software Group © 2006 IBM Corporation Rational Software France Object-Oriented Analysis and Design with UML2 and Rational Software Modeler 03. Classes,
Entity-Relationship Model Using High-Level Conceptual Data Models for Database Design Entity Types, Sets, Attributes and Keys Relationship Types, Sets,
UML Class Diagram Trisha Cummings. What we will be covering What is a Class Diagram? Essential Elements of a UML Class Diagram UML Packages Logical Distribution.
9-1 © Prentice Hall, 2007 Chapter 9: Analysis Classes Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey.
Chapter 11 & 12 Entity-Relationship (E-R) Model Characteristics of E-R Model Components of E-R Model Example of E-R Model Enhanced E-R Model.
1 A Demo of Logical Database Design. 2 Aim of the demo To develop an understanding of the logical view of data and the importance of the relational model.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
Chapter 2 : Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping Constraints Keys E-R Diagram Extended E-R Features Design of.
Lecture 1: UML Class Diagram September 12, UML Class Diagrams2 What is a Class Diagram? A class diagram describes the types of objects in the system.
Carnegie Mellon University © Robert T. Monroe Management Information Systems Data Modeling Management Information Systems Robert.
ITTelkom Entity Relationship Diagram (1) CS2343 Perancangan Basisdata Relasional.
UNIT_2 1 DATABASE MANAGEMENT SYSTEM[DBMS] [Unit: 2] Prepared By Lavlesh Pandit SPCE MCA, Visnagar.
Object Oriented Analysis: Associations. 2 Object Oriented Modeling BUAD/American University Class Relationships u Classes have relationships between each.
Entity Relationship Modeling
CSCI-383 Object-Oriented Programming & Design Lecture 10.
Computing & Information Sciences Kansas State University Friday, 26 Sep 2008CIS 560: Database System Concepts Lecture 13 of 42 Friday, 26 September 2008.
Database and Information Retrieval System
1 Announcements Reading for next week: Chapters 8 and 10  Last reading from the text for a little while (I promise) About those database accounts....
CS212: Object Oriented Analysis and Design Lecture 33: Class and Sequence Diagram.
Chapter 16 UML Class Diagrams 1CS6359 Fall 2012 John Cole.
7-1 © Prentice Hall, 2007 Topic 7: Analysis Classes Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey.
Chapter 3: Modeling Data in the Organization. Business Rules Statements that define or constrain some aspect of the business Assert business structure.
Class Diagram Lecture # 1. Class diagram A Class Diagram is a diagram describing the structure of a system shows the system's classes Attributes operations.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Mapping Constraints Keys.
Lecture 26 Enterprise Systems Development ( CSC447 ) COMSATS Islamabad Muhammad Usman, Assistant Professor.
Analysis Classes Unit 5.
Entity-Relationship Model
Entity-Relationship Model
Lec 3: Object-Oriented Data Modeling
Software Engineering Lecture #11.
UML Class Diagram.
Chapter 6: Entity-Relationship Model
Presentation transcript:

Understanding Advanced UML Concepts Gerd Wagner

Gerd Wagner: Understanding Advanced UML Concepts2 This Tutorial is … about conceptual modeling issues. addressing the view of analysts. restricted to state modeling (class models).

Gerd Wagner: Understanding Advanced UML Concepts3 This Tutorial is not … about design or implementation modeling. discussing plattform technologies. discussing behavior modeling (interaction diagrams and activity graphs).

Gerd Wagner: Understanding Advanced UML Concepts4 General Overview Part I: Warm Up Part II: Association Classes Part III: Customizing UML Standard Model Elements Part IV: Powertypes Part V: Aggregation/Composition Part VI: Expressing Integrity Constraints with OCL

Gerd Wagner: Understanding Advanced UML Concepts5 Overview Part I: Warm Up Objects and Classes Links and Associations Role Names Generalization (Integrity) Constraints

Gerd Wagner: Understanding Advanced UML Concepts6 Classifying Objects Objects of the same type can be classified by means of an object class which is visualized as a rectangle labelled with the name of this class.

Gerd Wagner: Understanding Advanced UML Concepts7 The Association has between Patient and Consultation “An instance of an Association is a Link, which is a tuple of Instances drawn from the corresponding Classifiers.”

Gerd Wagner: Understanding Advanced UML Concepts8 Associations with Role Names

Gerd Wagner: Understanding Advanced UML Concepts9 Generalization

Gerd Wagner: Understanding Advanced UML Concepts10 Integrity Constraints  In order to exclude system states that are not consistent with the intended information model, various types of integrity constraints can be expressed in a class model.  Important attribute constraints are:  mandatory (default) versus optional, and  single-valued (default) versus multi-valued.  Multiplicity constraints define for an association how many objects of one participating class can be associated with how many objects of the other one.

Gerd Wagner: Understanding Advanced UML Concepts11 Integrity Constraints (cont.) An association may be –functional (many-to-one), –inverse functional (one-to-many), –total –inverse total Many-to-many associations are neither functional nor inverse functional. Uniqueness constraints for defining keys are not well supported by UML 1.

Part II Association Classes

Gerd Wagner: Understanding Advanced UML Concepts13 Problem: How to include the date and time of an appointment? Consider the association hasAppointmentWith :

Gerd Wagner: Understanding Advanced UML Concepts14 Problem: How to include the date and time of an appointment? Consider the association hasAppointmentWith : Is this a solution?

Gerd Wagner: Understanding Advanced UML Concepts15 The Association Class Appointment Question: Can a patient have more than one appointment with the same doctor?

Gerd Wagner: Understanding Advanced UML Concepts16 No! PatientNoDoctorNoDateTime Dec-0115: Dec-0116: Jan-028: Dec-019: Dec-019: Dec-019:30 …………

Gerd Wagner: Understanding Advanced UML Concepts17 Turning an Association into an Object Class When we “objectify” an association (class), we can have more than one link between the same objects. Note that such a class still represents a relationship type, and not an entity type!

Gerd Wagner: Understanding Advanced UML Concepts18 Appointments as an Object Class DoctorNoDateTimePatientNo 1721-Dec-0115: Dec-0116: Jan-028: Dec-019: Dec-019: Dec-019: …………

Gerd Wagner: Understanding Advanced UML Concepts19 An association class … is an association that is also a class. It not only connects a set of classes but also defines a set of features that belong to the relationship itself and not any of the classes.

Gerd Wagner: Understanding Advanced UML Concepts20 Association Class versus Object Class is equivalent with

Gerd Wagner: Understanding Advanced UML Concepts21 Questions Are the following concepts association classes or object classes? a job a book reservation (in a library) a purchase (of a product individual) Make a justifiable choice between the two possibilities, and draw a corresponding class diagram, including all natural role names.

Part III Customizing UML Model Elements

Gerd Wagner: Understanding Advanced UML Concepts23 Tags, Constraints and Stereotypes are used in the definition of UML itself for defining standard model elements that are not considered complex enough to be defined directly as UML metaclasses A coherent set of Tags, Constraints and Stereotypes, defined for specific purposes, constitutes a UML profile.

Gerd Wagner: Understanding Advanced UML Concepts24 Tag Definitions allow to specify user-defined meta- attributes (tagged values) for a model element should be defined in conjunction with a stereotype since that allows them to be used in a more disciplined manner Example of a predefined tag: derived (refers to ModelElement)

Gerd Wagner: Understanding Advanced UML Concepts25 Examples of Tag Definitions TagBase Class or Stereotype TypeMulti- plicity aliasNames ModelElement UML::Datatypes: :String * derived ModelElement UML::Datatypes: :Boolean 1

Gerd Wagner: Understanding Advanced UML Concepts26 Constraints allow to specify semantics/usage for a model element may be expressed by means of (predefined or user-defined) keywords, or in a –designated constraint language (such as OCL) –a programming language –mathematical notation, or –natural language can be enforced by a tool, if it “understands” the syntax and semantics of the constraint language. Example of a predefined constraint keyword: disjoint (refers to Generalization)

Gerd Wagner: Understanding Advanced UML Concepts27 Stereotypes (1) provide a way of branding model elements allow adding user-defined categories of UML model elements by referring to a base class, which is a class in the UML metamodel such as Class, Association, etc. may specify additional constraints and tag definitions

Gerd Wagner: Understanding Advanced UML Concepts28 Stereotypes (2) may be used to indicate a difference in meaning or usage may be defined as a subclass of one or more existing stereotypes inheriting their constraints and tag definitions Example of a predefined stereotype: «type» (refers to Class)

Gerd Wagner: Understanding Advanced UML Concepts29 Example: UML Profile for Business Modeling StereotypeBase Class ParentConstraints Worker «worker» ClassNANone CaseWorker «caseWorker» ClassWorkerNone

Part IV Powertypes

Gerd Wagner: Understanding Advanced UML Concepts31 Powertypes are special classes, designated with the stereotype  powertype  In UML 1: “a user-defined metaelement whose instances are classes in the model.” In UML 2: “a class whose instances are subclasses of another class”.

Gerd Wagner: Understanding Advanced UML Concepts32 Example: ProductType

Gerd Wagner: Understanding Advanced UML Concepts33 Subclass Partitions and Powertypes

Gerd Wagner: Understanding Advanced UML Concepts34 Nested Powertype Constructions The instances of a powertype of order 1 are subclasses of a base type (not a powertype). Examples: EngineType, CarType The instances of a powertype of order 2 are powertypes of order 1. Example: ProductType The instances of a powertype of order n are powertypes of order n-1.

Gerd Wagner: Understanding Advanced UML Concepts35 Questions Make a diagram for AccountType, Account, CheckingAccount, SavingsAccount. Find another example of a powertype.

Part V Aggregation and Composition

Gerd Wagner: Understanding Advanced UML Concepts37 Aggregation An aggregation is a part-whole relationship, that is, a special binary association where the instances on one side are aggregates (or wholes) and the instances on the other side are their parts. An aggregation relationship may be called isPartOf or consistsOf.

Gerd Wagner: Understanding Advanced UML Concepts38 Composition If the parts in the part-whole relationship are non-shareable, it is called a composition (visualized as a black diamond). “A shareable aggregation denotes weak ownership; that is, the part may be included in several aggregates and its owner may also change over time.”

Gerd Wagner: Understanding Advanced UML Concepts39 Ex: An organization is composed of teams that consist of persons. Notice that Organization is a mandatory aggregate for Team, whereas Team is an optional aggregate for Person.

Gerd Wagner: Understanding Advanced UML Concepts40 Mandatory Aggregates and Mandatory Parts Engine is a mandatory part of Car, and Car is an optional aggregate for Engine. Heart is a mandatory part of HumanBody, and HumanBody is a mandatory aggregate for Heart.

Gerd Wagner: Understanding Advanced UML Concepts41 Lieftime Dependency UML 1: “the composite object is responsible for the creation and destruction of its parts” “if the composite is destroyed, it must destroy all its parts” However: lifetime dependency is a characteristic of part-whole relationships with inseparable parts. We can define our own tags for expressing this.

Gerd Wagner: Understanding Advanced UML Concepts42 Inseparable and Essential Parts Brain is an inseparable and essential part of Person.

Gerd Wagner: Understanding Advanced UML Concepts43 Inseparable Parts may be Shareable Although Lecture is an inseparable part of RegularCourse, it is shareable.

Gerd Wagner: Understanding Advanced UML Concepts44 An aggregation relationship is anti-symmetric: when an object o1 is part of an aggregate object o2, then o2 cannot be part of o1 transitive: when an object o1 is part of an aggregate object o2, and o2 is part of another aggregate object o3, then o1 is also part of o3.

Part VI Expressing Integrity Constraints with OCL

Gerd Wagner: Understanding Advanced UML Concepts46 Expressing Constraints with the Object Constraint Language (OCL) There are many types of constraints that cannot be expressed visually but have to be included as a piece of text, or a symbolic expression, in a class diagram. OCL can be used to write unambiguous constraints that can't be misinterpreted. OCL expressions do not have any side effects, which means that evaluating an OCL expression will not affect the object to which the expression is applied.

Gerd Wagner: Understanding Advanced UML Concepts47 OCL (continued) All expressions in OCL have a type and evaluate to a value from that type when applied to a specific context. In OCL, a constraint is called an invariant. In addition to invariants, OCL allows to define preconditions and postconditions for operations.

Gerd Wagner: Understanding Advanced UML Concepts48 Business Rules A rental car is available, if it is not assigned to a rental contract, and it does not require service. A driver of a rental car must be at least 25 years old. The age of a person is computed as the difference between the current year and the person’s birth year.

Gerd Wagner: Understanding Advanced UML Concepts49 Expressing Business Rules with OCL Invariants