bts430 systems analysis and design using uml interaction diagrams

12
BTS430 Systems Analysis and Design using UML Interaction Diagrams

Upload: amie-freeman

Post on 03-Jan-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: BTS430 Systems Analysis and Design using UML Interaction Diagrams

BTS430 Systems Analysis and Design using UML

Interaction Diagrams

Page 2: BTS430 Systems Analysis and Design using UML Interaction Diagrams

Definition

An interaction diagram illustrates how objects interact using messages for a given scenario.

UML has two main types—sequence and communication.

Page 3: BTS430 Systems Analysis and Design using UML Interaction Diagrams

Definition

Interaction diagrams “force us to think through the concrete details of what messages to send and to whom and in what order”. text, p.225

They define how we meet our “operation contracts”.

Page 4: BTS430 Systems Analysis and Design using UML Interaction Diagrams

Sequence Diagrams

: Register : Sale

makePayment(cashTendered)

makePayment(cashTendered)

: Paymentcreate(cashTendered)

UI Layer

Domain Layer

Page 5: BTS430 Systems Analysis and Design using UML Interaction Diagrams

Sequence Diagrams

:ProcessSaleFrame

UI Layer

Domain Layer

makePayment(cashTendered)

: Register : Sale

makePayment(cashTendered)

makePayment(cashTendered)

: Paymentcreate(cashTendered)

makePayment(cashTendered)

Page 6: BTS430 Systems Analysis and Design using UML Interaction Diagrams

Participants

Lifeline Boxes (roughly equal to class instances)

Common cases of notation:

:Sale s1:Sale

unnamed instance named instance

Page 7: BTS430 Systems Analysis and Design using UML Interaction Diagrams

Messages

Occur between objects Starting messages are initiated by a random

source or a specific source

:Register :Register

Random Source Specific Source

Page 8: BTS430 Systems Analysis and Design using UML Interaction Diagrams

Message Expression Syntax

see page 227 Examples:

startSale() or startSale desc=getDescription(itemID) OR

getDescription(itemID), with “product description” shown as a return

Page 9: BTS430 Systems Analysis and Design using UML Interaction Diagrams

Returns

:Register :Sale

makePayment(cashTendered)

change due

makePayment(cashTendered)

OR

changeDue=makePayment(cashTendered)

Page 10: BTS430 Systems Analysis and Design using UML Interaction Diagrams

Object Creation

:Register :Sale

makePayment(cashTendered)

:Paymentcreate(cashTendered)

makePayment(cashTendered)

invokes the “new” operator and calls the constructor:public class Sale{private Payment payment;public void makePayment( Money cashTendered ){ payment = new Payment( cashTendered );….and so on

Page 11: BTS430 Systems Analysis and Design using UML Interaction Diagrams

Object Destruction

:Register :Sale

makePayment(cashTendered)

:Paymentcreate(cashTendered)

makePayment(cashTendered)

Payment object destroyed

<<destroy>>

X

Page 12: BTS430 Systems Analysis and Design using UML Interaction Diagrams

Messages to Self

:Register

newSale()

clear()