Chapter 15 UML Interaction Diagrams. Larman, C. Applying UML and Patterns. 3rd Ed. Ed. Prentice-Hall: 2005.

Similar documents
Applying UML & Patterns (3 rd ed.) Chapter 15

Design. Furthermore, it is natural to discover and change some requirements during the design and implementation work of the early iterations.

Modeling Dynamic Behavior

Modeling Dynamic Behavior

COMP 354: INTRODUCTION TO SOFTWARE ENGINEERING

Introduction to Software Engineering (2+1 SWS) Winter Term 2009 / 2010 Dr. Michael Eichberg Vertretungsprofessur Software Engineering Department of

UML Behavioral Models

Sequence Diagram. A UML diagram used to show how objects interact. Example:

OO Design2. Design Artifacts

Sequence Diagram. r: Register s: Sale

References: Applying UML and patterns Craig Larman

Software Modeling & Analysis

Constantinos Constantinides Computer Science and Software Engineering Concordia University Montreal, Canada

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

COMP 6471 Software Design Methodologies

Sequence Diagrams. Massimo Felici. Massimo Felici Sequence Diagrams c

Chapter 3: Object Oriented Design

Design Engineering. Overview

Designing for Visibility & Mapping to Code CSSE 574: Session 4, Part 3

Mapping Designs to Code

Object-Interaction Diagrams: Sequence Diagrams UML

ADVANCED SOFTWARE DESIGN LECTURE 7 GRASP

Use Case Sequence Diagram. Slide 1

Responsibilities. Using several specific design principles to guide OO design decisions.

Lecture 21 Detailed Design Dynamic Modeling with UML

UML Sequence Diagrams

Interaction Modelling: Sequence Diagrams

Principles of Software Construction: Objects, Design, and Concurrency. Assigning Responsibilities to Objects. toad. Jonathan Aldrich Charlie Garrod

Information Expert (or Expert)

CTIS 359 Principles of Software Engineering SOFTWARE DESIGN OO(A)D

Domain Modeling- 2. Generalization

CS 846: Model-Based Software Engineering Winter 2012

Download FirstOODesignPractice from SVN. A Software Engineering Technique: (Class Diagrams)

Object-Oriented Modeling. Sequence Diagram. Slides accompanying Version 1.0

Object Oriented Methods with UML. Lecture -4

Unified Modeling Language (UML) Object Diagram and Interaction Diagrams

Object-oriented design. More UML

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

From designing to coding

EVENTS AND SIGNALS. Figure 1: Events. kinds of events Signal Event

CSE 308. UML Sequence Diagrams. Reading / Reference.

Creating Your Own Documents in RealtiWeb

Introduction to Software Engineering (2+1 SWS) Winter Term 2009 / 2010 Dr. Michael Eichberg Vertretungsprofessur Software Engineering Department of

Syllabus & Curriculum for Certificate Course in Java. CALL: , for Queries

Applying Some More Gang of Four Design Patterns CSSE 574: Session 5, Part 4

Object-Oriented Design

Introduction to Software Engineering (2+1 SWS) Winter Term 2009 / 2010 Dr. Michael Eichberg Vertretungsprofessur Software Engineering Department of

Sequence Diagrams. Sequence Diagrams. Version Sequence Diagrams are. History. simple powerful readable used to describe interaction sequences

PROCESSES AND THREADS

Some Software Engineering Techniques (Class Diagrams and Pair Programming)

Unified Modeling Language (UML)

Design Patterns. SE3A04 Tutorial. Jason Jaskolka

The learning objectives of this chapter are the followings. At the end of this chapter, you shall

Object Oriented Paradigm

Lecture 17: (Architecture V)

Unified Modeling Language

Principles of Software Construction: Objects, Design and Concurrency. Object-Oriented Design: Assigning Responsibilities.

Index. Index. More information. block statements 66 y 107 Boolean 107 break 55, 68 built-in types 107

KF5008 Program Design & Development. Lecture 3 Sequence Diagrams

Creating Your Own Documents in RealtiWeb

ADVANCED SOFTWARE DESIGN LECTURE 4 GRASP. Dave Clarke

Software Specification 2IX20

UML Essentials Dynamic Modeling

On to Object-oriented Design

What is a Model? Copyright hebley & Associates

3: Modeling Behavior with UML Sequence Diagrams

UML (Unified Modeling Language)

Object-Oriented Design

REPRESENTATION OF CLASS DIAGRAM AND SEQUENCE DIAGRAM IN PROCESS MODELING: UML-BASED STUDY

CMSC 433 Programming Language Technologies and Paradigms. Concurrency

Computation Abstractions. Processes vs. Threads. So, What Is a Thread? CMSC 433 Programming Language Technologies and Paradigms Spring 2007

INTERNATIONAL JOURNAL OF PURE AND APPLIED RESEARCH IN ENGINEERING AND TECHNOLOGY

Last Time: Object Design. Comp435 Object-Oriented Design. Last Time: Responsibilities. Last Time: Creator. Last Time: The 9 GRASP Patterns

Object Analysis & Design in the textbook. Introduction to GRASP: Assigning Responsibilities to Objects. Responsibility-Driven Design

UNIT I. 3. Write a short notes on process view of 4+1 architecture. 4. Why is object-oriented approach superior to procedural approach?

Object Interaction Sequence Diagrams

Introduction to UML What is UML? Motivations for UML Types of UML diagrams UML syntax Descriptions of the various diagram types Rational Rose (IBM.. M

Contents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix

CONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17

JAVA MOCK TEST JAVA MOCK TEST II

System Sequence Diagrams. Based on Craig Larman, Chapter 10 and Anuradha Dharani s notes

Object-Oriented Concepts and Principles (Adapted from Dr. Osman Balci)

CONTENTS. Chapter 1 Getting Started with Java SE 6 1. Chapter 2 Exploring Variables, Data Types, Operators and Arrays 13

Programmazione Avanzata e Paradigmi Ingegneria e Scienze Informatiche - UNIBO a.a 2013/2014 Lecturer: Alessandro Ricci

M257 Past Paper Oct 2007 Attempted Solution

Developing Shlaer-Mellor Models Using UML

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified)

Interactions A link message

Core Java - SCJP. Q2Technologies, Rajajinagar. Course content

Typed Scheme: Scheme with Static Types

Domain Model and Domain Modeling

UNIT-IV BASIC BEHAVIORAL MODELING-I

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

Software Design and Analysis CSCI 2040

Programming Paradigms Written Exam (6 CPs)

UML part I. UML part I 1/41

Multitasking Multitasking allows several activities to occur concurrently on the computer. A distinction is usually made between: Process-based multit

Practical UML : A Hands-On Introduction for Developers

CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE

Transcription:

Chapter 15 UML Interaction Diagrams Larman, C. Applying UML and Patterns. 3rd Ed. Ed. Prentice-Hall: 2005.

Fig. 15.1 : A myb : B doone dotwo dothree

Fig. 15.2 doone : A 1: dotwo 2: dothree myb : B

Fig. 15.3 : Register : Sale makepayment(cashtendered) makepayment(cashtendered) create(cashtendered) : Payment

Fig. 15.4 direction of message makepayment(cashtendered) :Register 1: makepayment(cashtendered) :Sale 1.1: create(cashtendered) :Payment

lifeline box representing an unnamed instance of class Sale Fig. 15.5 lifeline box representing a named instance lifeline box representing the class Font, or more precisely, that Font is an instance of class Class an instance of a metaclass :Sale s1 : Sale «metaclass» Font lifeline box representing an instance of an ArrayList class, parameterized (templatized) to hold Sale objects lifeline box representing one instance of class Sale, selected from the sales ArrayList <Sale> collection List is an interface in UML 1.x we could not use an interface here, but in UML 2, this (or an abstract class) is legal sales: ArrayList<Sale> sales[ i ] : Sale x : List related example

Fig. 15.6 dox : Register doa : Store 1 the 1 implies this is a Singleton, and accessed via the Singleton pattern

Fig. 15.7 : Register : Sale dox doa a found message whose sender will not be specified dob doc dod execution specification bar indicates focus of control typical sychronous message shown with a filled-arrow line

Fig. 15.8 : Register : Sale dox d1 = getdate getdate adate

Fig. 15.9 : Register dox clear

Fig. 15.10 : Register : Sale note that newly created objects are placed at their creation "height" makepayment(cashtendered) create(cashtendered) : Payment authorize

Fig. 15.11 : Sale create(cashtendered)... «destroy» : Payment X the «destroy» stereotyped message, with the large X and short lifeline indicates explicit object destruction

Fig. 15.12 : A : B makenewsale a UML loop frame, with a boolean guard expression loop [ more items ] enteritem(itemid, quantity) description, total endsale

Fig. 15.13 : Foo : Bar xx opt [ color = red ] calculate yy

Fig. 15.14 : Foo : Bar xx [ color = red ] calculate yy

Fig. 15.15 : A : B : C dox alt [ x < 10 ] calculate [ else ] calculate

Fig. 15.16 t = gettotal lineitems[i] : : Sale SalesLineItem This lifeline box represents one instance from a collection of many SalesLineItem objects. loop [ i < lineitems.size ] i++ st = getsubtotal lineitems[i] is the expression to select one element from the collection of many SalesLineItems; the i value refers to the same i in the guard in the LOOP frame an action box may contain arbitrary language statements (in this case, incrementing i ) it is placed over the lifeline to which it applies

Fig. 15.17 : Sale lineitems[i] : SalesLineItem t = gettotal loop st = getsubtotal

Fig. 15.18 : Foo : Bar xx opt [ color = red ] loop(n) calculate

Fig. 15.19 sd AuthenticateUser : A : B : C : B : C dox doa authenticate(id) ref dob AuthenticateUser authenticate(id) dom1 dom2 ref DoFoo sd DoFoo : B : C interaction occurrence note it covers a set of lifelines note that the sd frame it relates to has the same lifelines: B and C dox doy doz

Fig. 15.20 message to class, or a static method call dox : Foo 1: locs = getavailablelocales «metaclass» Calendar

Fig. 15.21 Payment is an abstract superclass, with concrete subclasses that implement the polymorphic authorize operation Payment {abstract} authorize() {abstract}... CreditPayment authorize()... DebitPayment authorize()... polymorphic message object in role of abstract superclass :Register :Payment {abstract} dox authorize stop at this point don t show any further details for this message :DebitPayment :Foo :CreditPayment :Bar authorize doa authorize dox dob separate diagrams for each polymorphic concrete case

Fig. 15.22 a stick arrow in UML implies an asynchronous call a filled arrow is the more common synchronous call In Java, for example, an asynchronous call may occur as follows: :ClockStarter active object System : Class // Clock implements the Runnable interface Thread t = new Thread( new Clock() ); t.start(); startclock create :Clock the asynchronous start call always invokes the run method on the Runnable (Clock) object run to simplify the UML diagram, the Thread object and the start message may be avoided (they are standard overhead ); instead, the essential detail of the Clock creation and the run message imply the asynchronous call runfinalization

Fig. 15.23 1: makepayment(cashtendered) 2: foo : Register :Sale 2.1: bar link line

Fig. 15.24 msg1 1: msg2 2: msg3 3: msg4 : Register :Sale 3.1: msg5 all messages flow on the same link

Fig. 15.25 msg1 : Register 1: clear

Fig. 15.26 Three ways to show creation in a communication diagram create message, with optional initializing parameters. This will normally be interpreted as a constructor call. 1: create(cashier) : Register :Sale 1: create(cashier) : Register :Sale {new} «create» 1: make(cashier) : Register :Sale if an unobvious creation message name is used, the message may be stereotyped for clarity

Fig. 15.27 msg1 : A 1: msg2 : B not numbered 1.1: msg3 legal numbering : C

Fig. 15.28 first second third msg1 : A 1: msg2 : B 1.1: msg3 2.1: msg5 2: msg4 : C fourth 2.2: msg6 fifth sixth : D

Fig. 15.29 conditional message, with test message1 1 [ color = red ] : calculate : Foo : Bar

Fig. 15.30 unconditional after either msg2 or msg4 : E 1a and 1b are mutually exclusive conditional paths 2: msg6 msg1 1a [test1] : msg2 : A : B 1b [not test1] : msg4 1a.1: msg3 : D 1b.1: msg5 : C

Fig. 15.31 runsimulation : Simulator 1 * [ i = 1..n ]: num = nextint : Random iteration is indicated with a * and an optional iteration clause following the sequence number

Fig. 15.32 t = gettotal : Sale 1 * [i = 1..n]: st = getsubtotal lineitems[i]: SalesLineItem this iteration and recurrence clause indicates we are looping across each element of the lineitems collection. This lifeline box represents one instance from a collection of many SalesLineItem objects. lineitems[i] is the expression to select one element from the collection of many SalesLineItems; the i value comes from the message clause. t = gettotal : Sale 1 *: st = getsubtotal lineitems[i]: SalesLineItem Less precise, but usually good enough to imply iteration across the collection members

Fig. 15.33 message to class, or a static method call dox : Foo 1: locs = getavailablelocales «metaclass» Calendar

Fig. 15.34 polymorphic message stop at this point don t show any further details for this message dox :Register authorize :Payment {abstract} object in role of abstract superclass authorize authorize :DebitPayment doa dob :Foo :CreditPayment dox :Bar separate diagrams for each polymorphic concrete case

Fig. 15.35 startclock :ClockStarter 3: runfinalization System : Class :Clock 1: create 2: run asynchronous message active object