UML

Object-Interaction Diagrams: Sequence Diagrams

Communication and Time



In communication diagrams, ordering of messages is achieved by labelling them with sequence numbers



This does not make temporal ordering easy to follow.

Sequence Diagrams



Sequence diagrams make temporal ordering explicit.



However, they do not contain explicit link information (so the correspondence with the class diagram is not as explicit as with communication diagrams).

A closer look

Components of Sequence Diagrams ■

Vertical axis: time, increasing downwards.



Objects that exchange messages in a behaviour trace are shown on the horizontal axis, at the top.



With every object is a vertical dashed line, which depicts an object's lifeline.



Over the object's active lifetime, the lifeline is a rectangle, which depicts when an object is active (i.e., has control).





The rectangle's size is proportional to how long the object is active.



Explicit time unit may be added.

Arrows depict messages from a sender object to a target object and the message is written along the arrow.

Types of Fragments ■

Alt: Alternative fragment for conditional logic expressed in the guards.



Loop: Loop fragment while guard is true.



Break: If guard is true, execute this fragment and jump to end of parent fragment.



Opt: Optional fragment that executes if guard is true.



Par: Parallel fragments that execute in parallel.



Critical: Critical region within which only one thread of control active at a time. No concurrent region (e.g.: par) may execute at the same time.



Ref: Reference to another diagram.



Assert: This behaviour is the only valid at that point.



Seq: Weak sequencing of messages; no order of reception.

Synchronous vs. Asynchronous



If you order a piece of equipment, and the salesman goes in the back of the store to get it, do you wait for the piece of equipment?



If you order a piece of equipment, and the salesman tells you it is backordered, and will arrive next week, do you wait for the piece of equipment?

Synchronous Messages



The sender object waits until target object finishes its proccessing of the message.



Target object processes only one message at a time.



Consequently, this behavior represents a single thread of control. 

only one object is active at any time

Asynchronous Messages



Sender object does not wait until target object finishes its processing of the message (execution of the called method).



Target object may accept many messages at a time.



Consequently, this behavior requires multiple threads of control. 

many objects can be active at any time



this is also known as concurrency

Depicting Asynchronous Messages



Instead of using a filled arrowhead, we use an open arrowhead (in both communication and sequence diagrams).



In sequence diagrams 





we may have two objects active at the same time (box). The sender object remains active after sending a message. The target object becomes active as well.

If the target object can accept multiple messages, how does it handle them?

Concurrency ■





If target object's method implements threading, 

It can thread itself to handle messages.



This is called operation level concurrency.

If target object itself implements threading, 

It can thread itself to handle messages.



This is called object level concurrency.

If objects don't implement any threading but the system is concurrent, objects must implement some way of handling messages: system level concurrency. 

Refuse message(s) if busy



Interrupt current executing message and start on new message



Queue message(s) for later processing (can be priority queue)

Message Priorities



One way to deal with asynchronous messages is to queue them.



That way, only one of them is processed at a time.



But what happens if one message is more important than others.



You can use priority levels to determine the order messages are processed.



What are the dangers of this?

Callback Mechanism



Uses asynchronous messages.



A subscriber object o1 is interested in an event e that occurs in o2.



o1 registers interest in e by sending a message (that contains a reference to itself) to o2 and continues its execution.



When e occurs, o2 will callback asynchronously to o1 (and any other subscribers).

Callback (but not to self) illustrated

Object creation/destruction



Sequence diagrams use 



A special method sent to the object (not its lifeline) to denote object creation. an X to symbolize the end-of-life of an object.



In garbage-collected languages, nothing needs to be done.



However, in other languages, such as C++, the memory must be freed.

Broadcast



Similar to iterative messaging, broadcast allows you to send a message to multiple objects.



However, contrary to iterative messaging, no references are required.



A broadcast is sent to all the objects in the system.



If only a specific category of objects is targeted, we call this narrowcast.

UML Object-Interaction Diagrams: Sequence Diagrams

we may have two objects active at the same time (box). ◇. The sender object remains active after sending a message. The target object becomes active as well.
Missing:

147KB Sizes 1 Downloads 242 Views

Recommend Documents

Weaving Multiple Aspects in Sequence Diagrams
In this paper, we focus on finite scenarios expressed by means of SDs. We will call base .... where common elements of both sets are duplicated. This operator is ...

uml diagrams for inventory management system pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. uml diagrams for ...

uml diagrams for human resource management system pdf ...
management system pdf. Download now. Click here if your download doesn't start automatically. Page 1 of 1. uml diagrams for human resource management ...

Wing Diagrams
Page 1. Wing Diagrams. Printable 8.5 by 11 Diagram set – gryphern on YouTube. Write to [email protected] for inquiries and reprinting permissions.

Diagrams
Neumann architectures to UNIX and Smalltalk, the best architects and designers .... graphical modeling of software, not just for objects. ... various tools support.

Vector Diagrams Worksheet.pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. Vector Diagrams ...

Jackson Structured Diagrams -
... with developing an object-oriented model of the application domain. ... Jackson structured development (JSD) is another mature methodology which has a ...

pdf origami diagrams
File: Pdf origami diagrams. Download now. Click here if your download doesn't start automatically. Page 1 of 1. pdf origami diagrams. pdf origami diagrams.

Jackson Structured Diagrams -
support for full life-cycle development. ... Object oriented analysis is concerned with developing an object-oriented model of the application domain. The.

home electrical wiring diagrams pdf
Page 1 of 1. home electrical wiring diagrams pdf. home electrical wiring diagrams pdf. Open. Extract. Open with. Sign In. Main menu. Displaying home electrical ...

program diagrams damdi pdf
File: Program diagrams damdi pdf. Download now. Click here if your download doesn't start automatically. Page 1 of 1. program diagrams damdi pdf. program ...

ternary diagrams and emergy accounting
Received 25 March 2004; accepted 2 September 2004. Abstract. Ternary diagrams .... for the damage to energy resources, each one varying from 0 to 100%.

ALE 17. Phase Changes and Phase Diagrams
The temperature decreases as more and more of the liquid is converted into a gas. ... Use the data below to calculate the total heat in Joules needed to convert ...

SeaLITHIUM VRC-100 Wiring Diagrams 10-2016.pdf
Sign in. Loading… Whoops! There was a problem loading more pages. Retrying... Whoops! There was a problem previewing this document. Retrying.

〈q|pic〉: Quantum Circuit Diagrams in LATEX - GitHub
28. 5 qpic and LATEX. 28. 5.1 Include 〈q|pic〉 Diagrams as PDF Graphics in a LATEX File . ... A Python script, which we call1 qpic, parses .... Figure 3: Quantum Fourier transform on three bits: diagram and code. It is worth .... discarded. Line 9

Jens Lemanski. Periods in the Use of Euler-Type Diagrams.
Jan 3, 2017 - leibniz; the second school was formed around Christian Weise in Zittau, and his students were samuel Grosser and Johann Christian lange.2.