简体   繁体   中英

How to make a UML diagram with a class that has a main method and no fields

I have a class that has a main() method and no fields and also it doesn't have a constructor. This class is just a simple class in a larger project, that I did it all by myself and that is why I feel like something is wrong.

I have to document the project with an UML diagram. I don't know what am I supposed to write in the diagram for such a simple class. Just the static methods?

How do I write the main class in the UML?

What you describe is a situation that is common in class-only languages, such as Java or C# , where every code must be to encapsulated in a class.

In this case, the main() method is a static method that is called to start your application. Usually it is a technical requirement and not very important feature for the OO design. This is why it rarely appears in a class diagram.

But it is a static method like any other, and in UML you could just want to show it as a static operation , by underlining its name.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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