Actionscript 3:事件处理的序列图

发布于 2024-10-11 02:31:14 字数 164 浏览 2 评论 0原文

我必须为我编写的软件绘制一些序列图。在我的软件中,我有一些调度自定义事件的对象和侦听这些事件的其他对象。

当谈到说明事件监听器和调度事件函数时,我有点困惑如何做到这一点。我用谷歌搜索了很多,但找不到正确的提示:(

或者序列图不是解释事件处理的好选择?

感谢您的帮助!

i have to draw some sequence diagrams for a software i wrote. In my Software i have some Objects that dispatch custom Events and other Objects that listens for these events.

When it comes to illustrate Eventlisteners und dispatchEvent-function i'm a little bit confused how to do that. I googled a lot, but couldn't find the right hint :(

Or is a sequence diagram not a good choice for explaining event handling?

Thanks for your help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

陌上青苔 2024-10-18 02:31:14

您的问题没有明确的答案,因为创建有用的图表很大程度上取决于您想向读者传达什么样的信息。我的建议是:你永远无法在一张图表中展示程序的所有功能;事件处理通常过于复杂和丑陋 - 尝试将其分成更小的部分并单独决定哪种图表对于您想要显示的哪些方面有用。

对于每一篇文章,您的重点应该始终放在读者身上:您希望他或她理解什么?

首先,通常最好编写用户故事并展示用例(如果您还没有这些)。它们传达了您的程序的功能,并帮助您识别流程并组织您对程序的思考方式。
对于每个流程,序列图可能最适合显示事物的工作原理。例如,如果您的程序功能之一是上传图像,您应该绘制一个序列图,显示仅在上传过程中涉及的主要组件、对象和事件序列。

下一步是对剩余的事件和对象进行分类,这些事件和对象更细粒度或不直接与用户交互:哪些事件是内部的(即在同一对象内调度和处理),哪些是外部的(在某些对象之间) ,甚至全局(影响整个应用程序)。这将帮助您识别彼此交互的对象组。
根据对象的复杂程度,我经常在状态图或流程图中显示内部事件序列。

如果您有一些较小的对象组,其中交互不太复杂并且更有趣的是谁做什么为什么而不是何时,您可以使用稍微改变的类图- 这些可能不是很正式,但对于某些概念来说,它们通常比流程图、状态图或序列图更有用。

还应该提到的是,在某些情况下,图表根本没有任何帮助。有时,编写提供示例的简短文本或在表格中收集信息会更有用。当读者理解您的程序的功能及其工作方式的概念时,文档就完成了。对于其他一切,总是有源代码。

There is no definitive answer to your question, because creating useful diagrams largely depends on what kind of information you want to convey to the reader. My advice is: You will never be able to show all your program's functionality in just one diagram; event handling is often too complex and ugly - try to split it up into smaller parts and decide individually, which kind of diagram is useful for which aspects you want to show.

For each one, your focus should always be on the reader: What do you want him or her to understand?

To start with, it's usually best to write user stories and show use cases, if you don't have those already. They convey the functionality your program was made for, and help you to identify processes and organize the way in which you think about your program.
For each of those processes, a sequence diagram is probably most useful to show how things work. For example, if one of your program features is uploading an image, you should draw a sequence diagram showing the main components, objects and sequences of events involved only in the upload procedure.

The next step is to categorize the remaining events and objects, which are more fine-grained or do not interact directly with the user: Which events are internal (i.e. dispatched and handled within the same object), which are external (between some objects), or even global (affecting the entire application). This will help you to identify groups of objects interacting with one another.
Depending on how complex an object is, I often display internal event sequences within a state diagram or flow chart.

If you have some smaller object groups where the interactions are not too complex and more interesting in terms of who does what why instead of when, you can possibly use slightly altered class diagrams - these might not be very formal, but for some concepts, they are often more useful than flow charts, state or sequence diagrams.

It should also be mentioned, that in some cases, a diagram doesn't really help at all. Sometimes it is far more useful to write a short text providing an example, or collect information in tables. Documentation is complete, when a reader understands the concepts of what your program does and how it does so. For everything else, there is always the source code.

つ低調成傷 2024-10-18 02:31:14

我不知道你到底想在这里做什么,但序列图完全能够代表你所描述的系统类型。 这里是一篇关于序列图的文章。查看异步消息和并发部分。另一篇文章 实际上有一个事件监听器的例子。它讨论了序列图和类图。我想您会对序列图的示例感兴趣。

I don't know exactly what you are trying to do here but sequence diagrams are perfectly capable of representing the sort of system you have described. Here is an article on sequence diagrams. Look at the section on asynchronous messages and concurrency. Another article actually has an example of an event listener. It talks about both sequence and class diagrams. I guess the example of sequence diagrams will be of interest to you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文