Relationships. Association Aggregation/Composition Multiplicity Dependencies

Similar documents
UML Class Diagrams Revisited

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

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

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

LABORATORY 1 REVISION

Basic Structural Modeling. Copyright Joey Paquet,

CS/IT Secure Software Construction

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

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

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

Unified Modeling Language (UML)

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

OO System Models Static Views

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

Unified Modeling Language (UML) Class Diagram

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

Object-Oriented Design

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

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

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

UML Tutorial. Unified Modeling Language UML Tutorial

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

Introducing the UML Eng. Mohammed T. Abo Alroos

UML: Unified Modeling Language

Design Engineering. Dr. Marouane Kessentini Department of Computer Science

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

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

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

Object Oriented Modeling

Static Modeling. SWE 321 Fall2014

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

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

Inheritance and Interfaces

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

Chapter 3 System Models

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

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

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

Chapter 2: Entity-Relationship Model

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

Advanced UML Class Models

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

Object Oriented Design (OOD): The Concept

12 Tutorial on UML. TIMe TIMe Electronic Textbook

UML Is Not a Methodology

Introduction to Unified Modelling Language (UML)

Chapter 2 ENTITY RELATIONSHIP MODEL

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

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

System Analysis and Design. Introduction: Object Oriented Design

Unified Modeling Language (UML) and Modeling

Chapter 5: Structural Modeling

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

Data and Process Modelling

UML Views of a System

OO Techniques & UML Class Diagrams

Object Oriented Methods with UML

Object-Oriented and Classical Software Engineering

Object Orientated Analysis and Design. Benjamin Kenwright

Modeling Databases Using UML

Chapter 6: Entity-Relationship Model

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

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

Design Aspects of the Standard I/O Library. Design with Java:

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

Unified Modeling Language

Chapter 1: Principles of Programming and Software Engineering

Object-Oriented Systems Analysis and Design Using UML

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Introduction to Software Engineering. 5. Modeling Objects and Classes

Software Design Models, Tools & Processes. Lecture 3: Addendum Cecilia Mascolo

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

Introduction to UML and Class Diagrams

Lesson 11. W.C.Udwela Department of Mathematics & Computer Science

UML Diagrams & And Some Of Their Elements

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

UML (Unified Modeling Language)

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

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

Written by John Bell for CS 342, Spring 2018

COSC 3311 Software Design Report 2: XML Translation On the Design of the System Gunnar Gotshalks

Learning Objectives. C++ For Artists 2003 Rick Miller All Rights Reserved xli

COP 3330 Final Exam Review

Chapter 11 Object and Object- Relational Databases

OO is considered to be supported in three points which are usually symbolized as the three vertexes of a triangle: Encapsulació i ocultació

Computer Programming II C++ (830)

Introduction to OO Concepts

Pertemuan 8. Object Oriented Modeling and Design

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

Object-Oriented Systems Development: Using the Unified Modeling Language

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

Chapter 4. In this chapter, you will learn:

UML Sequence Diagrams for Process Views

Course "Softwaretechnik" Book Chapter 2 Modeling with UML

Computer Programming II Python

Introduction to UML. Danang Wahyu utomo

ITEC420: Software Engineering Lecture 3: Recap OO/UML Requirement Workflow

Introduction to UML and Class Diagrams

The Essence of Object Oriented Programming with Java and UML. Chapter 2. The Essence of Objects. What Is an Object-Oriented System?

Transcription:

1/13/2004 1 Association Aggregation/Composition Dependencies 1/13/2004 2 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. 1/13/2004 3 1

Relationships in UML Window generalization open() close() move() Display() handleevent() Event dependency association ConsoleWindow DialogBox Control A relationship is a connection among things 1/13/2004 4 Binary Associations 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 1/13/2004 5 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. 1/13/2004 6 2

Unary Association Unary => a relationship between two different objects belonging to the same class prerequisite > is a prerequisite for (a different) 1/13/2004 7 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 1/13/2004 8 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 1/13/2004 9 3

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 1/13/2004 10 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 1/13/2004 11 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 1/13/2004 12 4

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 1/13/2004 13 Each end of an association is called a role. A role may have 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. 1/13/2004 14 * 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 1/13/2004 15 5

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. 1/13/2004 16 has a 1 1 Transcript works for 1..* 1 Department chairs 1 0..1 Department Grad GTA * 0..2 Department 1/13/2004 17 prerequisite > 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 1/13/2004 18 6

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. 1/13/2004 19 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 1/13/2004 20 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. 1/13/2004 21 7

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. 1/13/2004 22 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. 1/13/2004 23 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. 1/13/2004 24 8

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 1/13/2004 25 9