Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UML class diagrams main class

Tags:

java

uml

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?

like image 944
user13948 Avatar asked Dec 14 '15 14:12

user13948


People also ask

Do you put the main class in a UML diagram?

I would recommend you to use the class with main method only to init your application. In this case you don't need to include it into your diagram. But if the class that contains the main method is also part of the your application, the answer is yes you should do it.

What are classes in UML diagram?

In UML, a class represents an object or a set of objects that share a common structure and behavior. They're represented by a rectangle that includes rows of the class name, its attributes, and its operations.


2 Answers

Yes, the Main() can be modeled as a public static operation, just like any other operation.

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.

like image 166
Geert Bellekens Avatar answered Sep 28 '22 18:09

Geert Bellekens


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.

like image 22
reos Avatar answered Sep 28 '22 17:09

reos