280 likes | 496 Views
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
E N D
Concepts & Notations 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
Interaction View Interaction Diagram Sequence Diagram Examples UML Sequence Diagram
Interaction View • Objects interact to implement behavior • Two ways to describe interaction • focus 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
Interaction Diagram • Collaboration Diagram • Emphasizes structural relations between objects • Sequence Diagram • Illustrates how objects interacts with each other • Emphasizes time ordering of messages
book:Book :BookCopy borrow(book) ok = mayBorrow() [ok] borrow(member) setTaken(member) Sequence Diagram member:LibraryMember
book:Book :BookCopy borrow(book) ok = mayBorrow() [ok] borrow(member) setTaken(member) Sequence Diagram X-Axis (roles) member:LibraryMember Y-Axis (time)
book:Book :BookCopy borrow(book) ok = mayBorrow() [ok] borrow(member) setTaken(member) Sequence Diagram X-Axis (roles) member:LibraryMember head symbol Y-Axis (time) life line
book:Book :BookCopy borrow(book) ok = mayBorrow() [ok] borrow(member) setTaken(member) Sequence Diagram X-Axis (roles) member:LibraryMember head symbol Y-Axis (time) activation double line life line
bDay:Date Object • Naming • syntax • [instance Name]:[class Name] • Life line • represents the object’s life during the interaction
Object • Active Object • holds the root of a stack executions • has its own thread of control • Passive Object • objects that are called by an active object • receive control only when called
: Queue actor1 : … actor2 : … Object active object passive object active object pull pull
Message • An interaction between two objects • operation call • signaling • RPC • An arrow between the life lines of two objects • Labeled with • name • arguments • control information
: Queue actor1 : … actor2 : … Message pull pull message message
Synchronous Message • The routine that handles the message is completed before the caller resumes execution synchronous message :A :B doYouUnderstand() Caller Blocked yes return (optional)
Creation Message • An object may create another object via a create() message create message Preferred old:A create() :B
old:A new:B destroy() Destruction Message • An object may destroy another object via a destroy() message
:PrintServer :Queue :PrinterProxy job=dequeue() Examples Client print(doc,client) enqueue(job) Repeated forever with 1 min interludes [job]print(job.doc) status [job] done(status)
:PrintServer :Queue :PrinterProxy job=dequeue() Examples Client print(doc,client) enqueue(job) Repeated forever with 1 min interludes [job]print(job.doc) status [job] done(status)
:PrintServer :Queue :PrinterProxy job=dequeue() Examples Client print(doc,client) enqueue(job) Repeated forever with 1 min interludes [job]print(job.doc) status [job] done(status)
:PrintServer :Queue :PrinterProxy job=dequeue() Examples Client print(doc,client) enqueue(job) Repeated forever with 1 min interludes [job]print(job.doc) status [job] done(status)
:PrintServer :Queue :PrinterProxy job=dequeue() Examples Client print(doc,client) enqueue(job) Repeated forever with 1 min interludes [job]print(job.doc) status [job] done(status)
:PrintServer :Queue :PrinterProxy job=dequeue() Examples Client print(doc,client) enqueue(job) Repeated forever with 1 min interludes [job]print(job.doc) status [job] done(status)
:PrintServer :Queue :PrinterProxy job=dequeue() Examples Client print(doc,client) enqueue(job) Repeated forever with 1 min interludes [job]print(job.doc) status [job] done(status)
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