java UML类图主类
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34268941/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
UML class diagrams main class
提问by user13948
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?
在在线示例中,我没有看到类图中包含的主要方法。如果它应该在那里,我如何代表它?它是否就像任何其他方法一样,前面加 + 表示公共并加下划线表示它是静态的?如果不包括主要方法,为什么不包括在内?
采纳答案by Geert Bellekens
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.
如果您只对结构化的“实体”类视图感兴趣,那么主类可能就不那么有趣了。
回答by reos
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. It's the same as application servers you don't include the applicartion server classes in your Diagrams.
main 方法仅用于初始化您的应用程序,它不是您的应用程序模型的一部分。我认为它不应该包含在 UML 图中。这与您在图表中不包含应用程序服务器类的应用程序服务器相同。