如何在C#.NET事件构建体最好在UML类图来表示? [英] How can the c# .net event construct best be represented in a UML class diagram?

查看:940
本文介绍了如何在C#.NET事件构建体最好在UML类图来表示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设计的实体/组件系统,其中,内实体的通信的问题是由一个事件消息的系统解决。部件被分解成两部分,一个在实体和一种在一个子系统实体代理的,保持同步,通过观察者类型系统。我试图与事件和委托的实现。

I am designing an entity/component system where the problem of intra-entity communication is addressed by an event message system. components are broken into two parts, one in the entity and a sort of "entity proxy" in a subsystem, kept in sync through an observer type system. I am attempting an implementation with events and delegates.

我想我的应用程序的事件/邮件系统的结构模型,我有代表的麻烦。它现在的方式是一个图(附加)表示委托,EventArgs的,并在系统的实体,但它们之间的关系的性质只被表示为通用关联。我也有显示系统接口的第二图。我需要证明在这些对象引发的事件,因为这其中,最复杂的系统。

I am trying to model the structure of my application's event/messaging system and I am having trouble with the delegates. The way it is now is a diagram(attached) showing the delegate, eventArgs, and entities in the system, however the nature of their relationships is only being represented as generic associations. I also have a second diagram showing the system's interfaces. I need to show the events that are raised in these objects, as this where most of the complexity in the system is.

我知道我需要动态协作和时序图作为好了,但我试图找出什么样的,有多少不同的事件支持类,我需要以及继承结构将是什么样子。我想给我自己,我知道将携手消息类型的选择。我想,那么我可以选择衍生一个EventArgs,并从这些预定义的类型委托类型的动态图表和组件的建筑时间重用。

I know I need dynamic collaboration and timing diagrams as well, but I am trying to figure out what kind and how many different event support classes I need as well as what the inheritance structure will look like. I want to give myself a choice of message types that I know will work together. I figure then I can choose an EventArgs derivative and a delegate type from these pre-defined types to reuse at dynamic diagramming and component building time.

主要的事情,我可以' ŧ弄清楚是是否将事件作为一个属性或运作模式。我一直在尝试使用关联类的委托和OnSomeEvent()与事件的刻板印象式操作。因为事件不是操作我不喜欢这样。我已经在保护代码的方法与此有*的 * 的()命名约定了。委托签名,多播行为和观察者模式是不是真的用这种方法抓获。

The main thing I can't figure out is whether to model the event as an attribute or operation. I have been trying to use an association class for the delegate and an OnSomeEvent() type operation with an event stereotype. I don't like this because an event is not an operation. I have protected methods in the code with this On**() naming convention already. The delegate signature, multicast behavior and the observer pattern are not really captured by this approach.

用什么方法都用别人表达这些复杂和紧耦合类?对于我的图的一点是要既文件和更完全地理解在系统的接口。在这个阶段,我在过程中我希望能冻结接口和移动到实施组件本身。

What method are others using to express these complex and tightly coupled classes? The point of the diagrams for me is to both document and more completely understand the interfaces in the system. At this stage in my process I am hoping to freeze the Interfaces and move on to Implementing the components themselves.

推荐答案

我将不包括在静态类图信令字符,因为信号(这是什么事件是)是一个动态的行为。因为它们(即与他们的签名),并将其纳入一类为普通操作我想借此事件委托。我认为这将匹配的想法,一个物体能够相当appropirately发送事件,并将其指定的那种,如果该事件。

I wouldn't include the signaling character in a static class diagram because signaling (it's what events are for) is a dynamic behavior. I would take the event delegates as they are (i.e. with their signatures) and include them as ordinary operations of a class. I think this would match the idea that an object is capable of sending an event quite appropirately and it specifies the kind if the event.

哪些信号是要去哪里和谁。认购人应动态图进行建模

Which signals are going where and who is subscribed to whom should be modeled in a dynamic diagram.

编辑:

你有没有考虑加入定型例如<<事件>> <<信号>> 以你的类属性进行分类?

Have you considered adding stereotypes like << event >> or << signal >> to classifying attributes on your class ?

这篇关于如何在C#.NET事件构建体最好在UML类图来表示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆