简体   繁体   中英

How to show event in a sequence diagram

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

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.

在UML序列图上表示.NET事件

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM