UML Class Diagrams Revisited

Similar documents
Relationships. Association Aggregation/Composition Multiplicity Dependencies

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

LABORATORY 1 REVISION

CS/IT Secure Software Construction

2 UML for OOAD. 2.1 What is UML? 2.2 Classes in UML 2.3 Relations in UML 2.4 Static and Dynamic Design with UML. UML for OOAD Stefan Kluth 1

(C) 2010 Pearson Education, Inc. All rights reserved. Dr. Marenglen Biba

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

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

A - 1. CS 494 Object-Oriented Analysis & Design. UML Class Models. Overview. Class Model Perspectives (cont d) Developing Class Models

Basic Structural Modeling. Copyright Joey Paquet,

OO System Models Static Views

Class diagrams. Modeling with UML Chapter 2, part 2. Class Diagrams: details. Class diagram for a simple watch

Class diagrams. Modeling with UML Chapter 2, part 2. Class Diagrams: details. Class diagram for a simple watch

Unified Modeling Language (UML)

Accessibility. EEC 521: Software Engineering. Classes and Objects. Inheritance. Classes and Objects (OO Analysis)

Chapter No. 2 Class modeling CO:-Sketch Class,object models using fundamental relationships Contents 2.1 Object and Class Concepts (12M) Objects,

Unified Modeling Language (UML) Class Diagram

Modellistica Medica. Maria Grazia Pia, INFN Genova. Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico

CMSC 424 Database design Lecture 3: Entity-Relationship Model. Book: Chap. 1 and 6. Mihai Pop

Object-Oriented Design

Advanced UML Class Models

Class Diagram. Classes consist of. Note that class diagrams contain only classes, not objects.

Class Diagram. Classes consist of. Note that class diagrams contain only classes, not objects.

UML Fundamental. OutLine. NetFusion Tech. Co., Ltd. Jack Lee. Use-case diagram Class diagram Sequence diagram

UML Modeling I. Instructor: Yongjie Zheng September 3, CS 490MT/5555 Software Methods and Tools

UML Tutorial. Unified Modeling Language UML Tutorial

Object-Oriented and Classical Software Engineering

Object-Oriented Analysis, Design and Implementation. Case Study Part II

Inheritance and Interfaces

UML Is Not a Methodology

CS 370 REVIEW: UML Diagrams D R. M I C H A E L J. R E A L E F A L L

Object-Oriented Programming. Objects. Objects. Objects

CSE 403: Software Engineering, Spring courses.cs.washington.edu/courses/cse403/15sp/ UML Class Diagrams. Emina Torlak

Introduction to Unified Modelling Language (UML)

Chapter 2: Entity-Relationship Model

1/17/2014. UML Help and Details (from: UML for cse UML for a class. UML and project clarifications

CMPT 354 Database Systems I

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

SOFTWARE ENGINEERING Prof.N.L.Sarda Computer Science & Engineering IIT Bombay. Lecture #10 Process Modelling DFD, Function Decomp (Part 2)

Introducing the UML Eng. Mohammed T. Abo Alroos

ACS-3913 Ron McFadyen 1. UML Notation for Class diagrams Object diagrams

Chapter 2 ENTITY RELATIONSHIP MODEL

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

Unified Modeling Language

Database Design Using E/R Model

UML Views of a System

UML: Unified Modeling Language

Chapter 6: Entity-Relationship Model

Relational Database Design Part I. Announcements (September 5) Relational model: review. CPS 116 Introduction to Database Systems

Design Engineering. Dr. Marouane Kessentini Department of Computer Science

Modeling Databases Using UML

Chapter 2. Database Design. Database Systems p. 25/540

Object Oriented Modeling

Object-Oriented Systems Analysis and Design Using UML

Introduction to Software Engineering. 5. Modeling Objects and Classes

Static Modeling. SWE 321 Fall2014

Introduction to Computers and Programming Languages. CS 180 Sunil Prabhakar Department of Computer Science Purdue University

CSI 32. Lecture Object-Oriented Paradigm. UML (Unified Modeling Language)

3. Advanced E/R Concepts

UML class diagrams. Nigel Goddard. School of Informatics University of Edinburgh

Software Development Cycle. Unified Modeling Language. Unified Modeling Language. Unified Modeling Language. Unified Modeling Language.

Chapter 3 System Models

Chapter 11 Object and Object- Relational Databases

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

UML Diagrams & And Some Of Their Elements

Object-Oriented Programming

administrivia today UML start design patterns Tuesday, September 28, 2010

Tutorial notes on. Object relational structural patterns

Object Oriented Design. Program Design. Analysis Phase. Part 2. Analysis Design Implementation. Functional Specification

Chapter 4. In this chapter, you will learn:

Object Oriented Design (OOD): The Concept

12 Tutorial on UML. TIMe TIMe Electronic Textbook

UNIT V *********************************************************************************************

Object Fundamentals Part Two. Kenneth M. Anderson University of Colorado, Boulder CSCI 4448/5448 Lecture 3 09/01/2009

UML & OO FUNDAMENTALS CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 3 08/30/2011

OO Overkill When Simple is Better than Not

Principles of Software Construction: Objects, Design and Concurrency. Just enough UML. toad

Unified Modeling Language (UML) and Modeling

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

UML Sequence Diagrams for Process Views

Chapter 5: Structural Modeling

Announcement. Relational Database Design Part I. Keys. Relational model: review. Schema vs. data. More examples of keys

System Analysis and Design. Introduction: Object Oriented Design

3. Advanced E/R Concepts

What is a Class Diagram? A diagram that shows a set of classes, interfaces, and collaborations and their relationships

What is a Class Diagram? Class Diagram. Why do we need Class Diagram? Class - Notation. Class - Semantic 04/11/51

OO Techniques & UML Class Diagrams

Data and Process Modelling

Object Orientated Analysis and Design. Benjamin Kenwright

Object Oriented Methods with UML

Introduction to OO Concepts

Practical UML - A Hands-On Introduction for Developers

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Polymorphism: Inheritance Interfaces

COSC 304 Introduction to Database Systems Enhanced Entity-Relationship (EER) Modeling

CS 4604: Introduction to Database Management Systems. B. Aditya Prakash Lecture #5: Entity/Relational Models---Part 1

Course "Softwaretechnik" Book Chapter 2 Modeling with UML

2.1 Introduction UML Preliminaries Class diagrams Modelling delegation... 4

Class modelling (part 2)

Chapter 1: Principles of Programming and Software Engineering

Transcription:

9/25/2003 1 UML Class diagrams Organizing attributes and operations Class relationships Association Aggregation/Composition Multiplicity Dependencies 9/25/2003 2 UML Class Diagrams Revisited In the analysis & design phases, class diagrams are used to organize the attributes and operations of a class. The simplest class diagram lists only the names of attributes without their types, and lists method names without parameters or types. Simplicity is good name ssn birthdate gpa registerfor () drop () choosemajor() get and set methods are implied and not shown 9/25/2003 3 1

UML Class Diagrams Revisited Static attributes are underlined totals name ssn birthdate gpa registerfor () drop () choosemajor() 9/25/2003 4 Relationships Very few classes stand alone in an OO system Three kinds of class/object relationships are defined to help model abstractions 1. Associations represent structural relationships among objects 2. Generalizations link generalized(parent) classes to their specializations(subclasses ) 3. Dependencies represent using relationships among classes Dependencies and generalizations are onesided. 9/25/2003 5 Relationships in UML Window generalization open() close() move() Display() handleevent() Event dependency association ConsoleWindow DialogBox Control A relationship is a connection among things 9/25/2003 6 2

Binary Associations Multiplicity indicator goes here association name Class 1 Class 2 role of class 1 role of class 2 Use only if value added Binary =>A relationship between two different classes; Indicated with a line between classes 9/25/2003 7 Binary Associations advises advisor is advised by advisor < advises advisor If the direction of the association is not clear, a direction arrow can be added. The arrow does not imply visibility or navigability. 9/25/2003 8 Unary Association Unary => a relationship between two different objects belonging to the same class prerequisite > is a prerequisite for (a different) 9/25/2003 9 3

Aggregation Aggregation is an association that implies containment Not usually labeled University School containing class a University is comprised of Schools: School of Law, School of Medicine, SICE, etc. This relationship could also be modeled as a binary association 9/25/2003 10 Aggregation Involving Two Classes When two or more different classes represent parts of some other whole, each part is involved in a separate aggregation with the whole Nothing is implied about relationship of PartA to PartB Whole Part A Part B 9/25/2003 11 Composition Composition is a strong from of aggregation. The parts of a composition can be part of at most one composition at a time. If the composition goes away, the parts of that composition may go away, be moved to another composition, or assume responsibility for themselves. It is up to the composite to decide the fate of the parts 9/25/2003 12 4

Composition ATM 1 1 1 Display CardReader CashDispenser The composition relationship is denoted with a filled diamond. The relationship shown here means that there is only one ATM object. The Display, CardReader and CashDispenser can be associated with at most one ATM 9/25/2003 13 Associations - a Recap An association declares a connection between two classes Aggregation is an association with whole/part semantics. A part may be included in several aggregates Composition is an aggregate with the added condition that a part may be included in at most one composition 9/25/2003 14 Generalization (inheritance) Illustrated by connecting a subclass to its parent with a line ending in an open triangle touching the base class. Person Person Single inheritance involving one subclass Single inheritance involving two subclasses 9/25/2003 15 5

Multiplicity Each end of an association is called a role. A role may have multiplicity Multiplicity indicates the number of objects of each type that can participate in the association name description describes > 1 * date time Section One object may be associated with 0 or more Section objects. For every Section object, there is only one object. 9/25/2003 16 Multiplicity * 3 1..* 4,6,8,12 10..30 0 or many Exactly 3 1 or more Exactly 4,6,8 or 12 10 to 30 Types of multiplicities allowed 9/25/2003 17 Multiplicity registers for 10..30 * Interpretation: An object of type may be enrolled in 0 or more courses. i.e., there is no limit to the number of courses a student can take. At least 10 students are needed for a course offering, and no more than 30 students can sign up for one course. 9/25/2003 18 6

Multiplicity has a 1 1 Transcript works for 1..* 1 Department chairs 1 0..1 Department Grad GTA * 0..2 Department 9/25/2003 19 prerequisite > Multiplicity 0..* 0..* A is prerequisite for many s, and a can have 0 or more prerequisites PlanOfStudy * * A student s Plan of Study is comprised of many s; any given can be included in many different students Plans of Study 9/25/2003 20 Dependencies An association represents a permanent link between two objects. i.e. the link exists during the whole lives of the objects, although the instances that are connected may change over time. A parameter reference, or the creation of an object, does not imply an association; these are modeled with dependencies. Dependencies are between classes or packages. They show that one class uses another class as an argument in the signature of an operation. String Buffer String A String Buffer has several routines that take a String as a parameter. If the class String changed, String Buffer would have to be analyzed for possible changes also. 9/25/2003 21 7

Dependencies A dependency exists between two classes or packages if changes to the definition of one may cause changes to the other. Examples of dependencies between classes: one class sends a message to another one class has another as part of its data one class has another class as a parameter to an operation If a class changes its interface, any message it sends may no longer be valid. A dependency between two packages exists if a dependency exists between any two classes in the packages 9/25/2003 22 Dependencies FilmClip name playon(c:channel) start() stop() reset() Channel Create a dependency pointing from the class with the operation to the class used as a parameter in the operation. 9/25/2003 23 Dependencies Schedule add (c: ) remove (c: ) <<friend>> Iterator This dependency models a C++ idiom: friend. The stereotype Specifies that this is not a plain dependency, but represents a Friend. 9/25/2003 24 8

Dependencies Dependencies may also be used to show that a class relies on an interface. InputStream <<interface>> DataInput OrderReader generalization dependency DataInputStream realization (implements) Interfaces and Abstract Class: example from Java The dependency between the OrderReaderand DataInput means that if the DataInput interface changes, the OrderReadermay also have to change. 9/25/2003 25 Relationships Recap In an association, classes are peers of one another. Both rely on the other in some way and you can navigate in either direction. In a generalization, the parent knows nothing about its children In a dependency, one class depends on the other, but the class depended on has no knowledge of the dependent class. 9/25/2003 26 Modeling Hints When you model relationships in UML Use dependencies only when the relationship is not structural Use generalization when you have is-a-kind-of relationship; replace multiple inheritance with aggregation Keep generalizations balanced (not too deep or too wide) Use associations where there are structural relationships among objects 9/25/2003 27 9