UML Sequence Diagram

25
UML SEQUENCE DIAGRAM Concepts & Notations

description

Concepts & Notations. UML Sequence Diagram. Acknowledgements. The material in this tutorial is based in part on: The Unified Modeling Language Reference Manual, 2 nd edition , by James Rumbaugh , Ivar Jacobson, and Grady Booch. Interaction View Interaction Diagram Sequence Diagram - PowerPoint PPT Presentation

Transcript of UML Sequence Diagram

Page 1: UML Sequence Diagram

UML SEQUENCE DIAGRAM

Concepts & Notations

Page 2: UML Sequence Diagram

Acknowledgements The material in this tutorial is

based in part on:

The Unified Modeling Language Reference Manual, 2nd edition, by James Rumbaugh, Ivar Jacobson, and Grady Booch

Page 3: UML Sequence Diagram

UML Sequence Diagram

Interaction View Interaction Diagram Sequence Diagram Examples

Page 4: UML Sequence Diagram

Interaction View Objects interact to implement behavior

Two ways to describe interactionfocus on individual objects (state machine)focus on interactions of a collection of

cooperating objects (interaction view)

Provides a more holistic view of the behavior of a set of objects

Page 5: UML Sequence Diagram

Interaction Diagram Collaboration Diagram

Emphasizes structural relations between objects

Sequence DiagramIllustrates how objects interacts with each

otherEmphasizes time ordering of messages

Page 6: UML Sequence Diagram

Sequence Diagram

member:LibraryMember book:Book :Book

Copy

borrow(book)ok = mayBorrow()

[ok] borrow(member)setTaken(member)

Page 7: UML Sequence Diagram

Sequence Diagram

member:LibraryMember book:Book :Book

Copy

borrow(book)ok = mayBorrow()

[ok] borrow(member)setTaken(member)

X-Axis (roles)

Y-Axis (tim

e)

Page 8: UML Sequence Diagram

Sequence Diagram

member:LibraryMember book:Book :Book

Copy

borrow(book)ok = mayBorrow()

[ok] borrow(member)setTaken(member)

X-Axis (roles)

Y-Axis (tim

e)

head symbol

life line

Page 9: UML Sequence Diagram

Sequence Diagram

member:LibraryMember book:Book :Book

Copy

borrow(book)ok = mayBorrow()

[ok] borrow(member)setTaken(member)

X-Axis (roles)

Y-Axis (tim

e)

head symbol

life line

activation double line

Page 10: UML Sequence Diagram

Object Naming

syntax[instance Name]:[class Name]

Life linerepresents the object’s life during the

interaction

bDay:Date

Page 11: UML Sequence Diagram

Object Active Object

holds the root of a stack executionshas its own thread of control

Passive Objectobjects that are called by an active objectreceive control only when called

Page 12: UML Sequence Diagram

Object

pull

pull

: Queueactor1 : … actor2 : …

active object active objectpassive object

Page 13: UML Sequence Diagram

Message An interaction between two objects

operation callsignalingRPC

An arrow between the life lines of two objects

Labeled withnameargumentscontrol information

Page 14: UML Sequence Diagram

Message

pull

pull

: Queueactor1 : … actor2 : …

message

message

Page 15: UML Sequence Diagram

Synchronous Message The routine that handles the message is

completed before the caller resumes execution

:A :B

doYouUnderstand()Caller

Blocked

return (optional

)

yes

synchronous message

Page 16: UML Sequence Diagram

Creation Message An object may create another object via

a create() message

old:A

create() :B

Preferredcreate

message

Page 17: UML Sequence Diagram

Destruction Message An object may destroy another object

via a destroy() message

old:A new:B

destroy()

Page 18: UML Sequence Diagram

Examples

print(doc,client)Client

:PrintServer :Queue :PrinterProxy

enqueue(job)

status

job=dequeue()

[job]print(job.doc)

[job] done(status)

Repeated forever with 1 min interludes

Page 19: UML Sequence Diagram

Examples

print(doc,client)Client

:PrintServer :Queue :PrinterProxy

enqueue(job)

status

job=dequeue()

[job]print(job.doc)

[job] done(status)

Repeated forever with 1 min interludes

Page 20: UML Sequence Diagram

Examples

print(doc,client)Client

:PrintServer :Queue :PrinterProxy

enqueue(job)

status

job=dequeue()

[job]print(job.doc)

[job] done(status)

Repeated forever with 1 min interludes

Page 21: UML Sequence Diagram

Examples

print(doc,client)Client

:PrintServer :Queue :PrinterProxy

enqueue(job)

status

job=dequeue()

[job]print(job.doc)

[job] done(status)

Repeated forever with 1 min interludes

Page 22: UML Sequence Diagram

Examples

print(doc,client)Client

:PrintServer :Queue :PrinterProxy

enqueue(job)

status

job=dequeue()

[job]print(job.doc)

[job] done(status)

Repeated forever with 1 min interludes

Page 23: UML Sequence Diagram

Examples

print(doc,client)Client

:PrintServer :Queue :PrinterProxy

enqueue(job)

status

job=dequeue()

[job]print(job.doc)

[job] done(status)

Repeated forever with 1 min interludes

Page 24: UML Sequence Diagram

Examples

print(doc,client)Client

:PrintServer :Queue :PrinterProxy

enqueue(job)

status

job=dequeue()

[job]print(job.doc)

[job] done(status)

Repeated forever with 1 min interludes

Page 25: UML Sequence Diagram

Review Time on y-axis, roles on x-axis Activation bars represent executions of

procedures Active objects have bars Solid arrowheads: synchronous Stick arrowheads: asynchronous Dashed message lines: return

:PrintServer