回调函数/类的UML类建模 [英] UML class modeling of callback functions/classes

查看:1240
本文介绍了回调函数/类的UML类建模的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不是UML专家,我只是在毕业前花了大量的时间来完成UML建模。我理解的基础知识,但我正在一个项目的另一天,只是为了我自己的好奇心,我想知道如何将模型回调。这是我正在使用的代码的一部分

I'm no expert in UML, I just took a course before I graduated that spent a significant amount of time on UML modeling. I understand the basics but I was working on a project the other day and just for my own curiosity, I was wondering how you would model a callback. Here is a portion of the code I was working on



class OnChangeHandler():

    def my_init(self, rem, loc):
        self.remotes = rem
        self.locals = loc

    def process_IN_CREATE(self, event):
        #Do some work

    def process_IN_MODIFY(self, event):
        #Do some other work





class Watch():
    def __init__(self):

        self.wm = WatchManager()
        self. notifier = AsyncNotifier(self.wm, OnChangeHandler(loc=self.locals, rem=self.remotes))


b $ b

我明显使用了一个框架,所以我想我的问题归结为:如何使用黑盒模块和框架来建模复杂的关系?它只是不值得花时间吗?但是如果是这样,并不是框架内建立的大多数程序?我发现UML类模型在我们学习时真的很有帮助,但现在我只是困惑。

I'm using a framework obviously, so I guess my question boils down to how would you model complex relationships where you are working with black box modules and frameworks? Is it just not even worth spending time on? But if so, aren't the majority of programs built within frameworks? I found UML class models to be really helpful when we were learning, but now I'm just confused.

推荐答案

一个框架通过逆转.class为了得到一个类图。

You can reverse a framework by reversing the .class in order to get a class diagram.

请参阅下面的框架示例: http://www.ejb3.org/jar_file_reverse/jar_file_reverse.html
类图将给出应用程序的结构及其体系结构的视图。

See an example of a framework reverse at: http://www.ejb3.org/jar_file_reverse/jar_file_reverse.html The class diagram will give a view of the structure of the application and its architecture.

顺序图也是可能的,以便了解运行应用程序时发生了什么。它有助于更​​好地理解.java类如何与框架.class类反应。请参见示例: http://www.ejb3.org/jar_file_reverse/jar_file_reverse .html#3.Sequence_Diagram_reverse_engineering
如果您需要添加新代码并重用现有的已编译代码,这将非常有用。

The sequence diagram is also possible in order to understand what is going on when running the application. It helps to have a better understanding of how a .java class could react with a framework .class class. See an example at: http://www.ejb3.org/jar_file_reverse/jar_file_reverse.html#3.Sequence_Diagram_reverse_engineering It is very useful if you need to add new code and reuse existing compiled code.

希望这有助。

这篇关于回调函数/类的UML类建模的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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