How do you show events in UML Class Diagrams? [closed]

扶醉桌前 提交于 2019-11-29 12:24:41

问题


This one has me stumped regularly while creating top level class diagrams for documentation. Methods and attributes/fields are easy to model. I usually end up adding a method named EvChanged to indicate a .Net event Changed.

What is the right way to show that a type publishes a specific event?


回答1:


Just add an «event» stereotype to a classifier attribute.




回答2:


I find onEventName() the easiest naming scheme for event callbacks, but how to indicate which events an object can broadcast I've not found any solution. An extended UML class diagram that would allow for customized containers (besides the attribute and method contrainers) could be an alternative, if some tool would support it.




回答3:


I don't think there is any specific UML notation for showing events that a Class can broadcast. To show events that a Class can receive, you want a Reception element. This has a similar notation to an Operation, with the «signal» keyword.




回答4:


I create a stereotype in the model, "PublishedEvent", with a BaseClass of Operation. I apply the stereotype to the Operations in the class.




回答5:


Not the type of answer that I like to give, but Microsoft has an answer on the Office website.



来源:https://stackoverflow.com/questions/51464/how-do-you-show-events-in-uml-class-diagrams

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!