How to visualize timer functionality in sequence diagram?

Posted by truthseeker on Programmers See other posts from Programmers or by truthseeker
Published on 2012-06-20T07:31:22Z Indexed on 2012/06/20 9:24 UTC
Read the original article Hit count: 346

Filed under:
|
|

I am developing software for communication with external device through serial port. To better understand the new functionality I am trying to display it in sequence diagram. Flow of events is as follows. I send to the device command to reset it. This is asynchronous operation so there is some delay between request and response (typically 100 ms). There can be case when the answer never comes (for example device is not connected to the specified port or is currently turned off). For this purpose I create a timer with period twice the maximum answer time. In my case it is 2 * 125 ms = 250 ms. If the answer comes in predefined time interval, I destroy already running timer. If the answer doesnt come in predefined interval, timer initiates some action. After this action we can destroy it. How to effectively model this situation in sequence diagram?

Addendum 1:

Based on advices made by scarfridge i drew following UML diagram. Comment by Ozair is also helpful for simplifying the diagram even more.

enter image description here

© Programmers or respective owner

Related posts about uml

Related posts about time