Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show event in a sequence diagram

Tags:

uml

modeling

I want to draw a sequence diagram and I want to show interaction between user and UI. User as an actor would fill a text box and on text_change event an asynchronous method of BL class would call. In this case is it possible to show text_change event on the diagram? and how can I show it?

thanks

like image 995
Vahid Ghadiri Avatar asked Sep 01 '12 13:09

Vahid Ghadiri


2 Answers

To represent interactions in a more or less complex and GUI-rich applications I, too, often found myself interested in representing .NET events in sequence diagrams. To my view, there is no really descriptive way to effectively do it using standard means.

A formally justifiable way could be as follows: raising an event is basically nothing but calling a defined function in the target instance, the only difference is that you call it not directly, but via the system event message loop. So, behind the scenes, raising an event is identical to calling some HandleMessage("MyEvent", params object[] args) function in the system itself, the parameters being the name of the event and a list of optional arguments. I do not know what the exact name and signature are, but this does not really matter.

A representation of .NET event on an UML sequence diagram

In the above figure, a Source instance issues an event MyEvent with a list of arguments that lands on the system receiver. The receiver finds the addressee (Target) and calls its corresponding method (Target.OnMyEvent()). To emphasize that this call is event-triggered, I introduce a stereotype called "Event".

This scheme may look somewhat clumsy, but, to me, it covers the case.

like image 53
Alex Konnen Avatar answered Oct 25 '22 15:10

Alex Konnen


What you want to do is possible but unusual. Typically these interactions would be provided by the existing system/platform and it would therefore not be necessary to include it in the application design.

Introduces how this would typically be documented

I would probably use a collaboration digram to do it.

If you insist on Sequence Diagrams figure 2 should help

like image 34
Martin Spamer Avatar answered Oct 25 '22 16:10

Martin Spamer