简体   繁体   English

UML类图主类

[英]UML class diagrams main class

In no examples online have I seen the main method included in class diagrams. 在网上没有示例中,我没有看到类图中包含的主要方法。 If it should be there, how do I represent it? 如果应该存在,我该如何表示? Is it just like any other method, preceded by + to denote public and underlined to show it's static? 它是否与其他任何方法一样,以+开头表示公共并带有下划线以表示它是静态的? If main methods don't get included, why not? 如果不包括主要方法,为什么不呢?

Yes, the Main() can be modeled as a public static operation, just like any other operation. 是的,就像其他任何操作一样, Main()可以建模为公共静态操作。

Whether or not you find it interesting to model depends on your viewpoint. 您是否觉得建模很有趣取决于您的观点。 If you wish to model the behavioral details and sequences of messages when running your application, then yes, it might be very useful. 如果您希望在运行应用程序时对行为细节和消息序列进行建模,那么可以,它可能非常有用。

If you are only interested in a structural "entity" class view, then the main class might not be that interesting. 如果您只对结构化的“实体”类视图感兴趣,那么主类可能不会那么有趣。

The main method is only use for init your application, it is not part of you application model. 主要方法仅用于初始化应用程序,而不是应用程序模型的一部分。 I think it should not be included in the UML diagram. 我认为它不应该包含在UML图中。 It's the same as application servers you don't include the applicartion server classes in your Diagrams. 与您在图中未包含applicartion服务器类的应用程序服务器相同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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