UML: How do I do this ...?
A few UML questions: Do I include the main class in the UML diagram? If I turn it on and it creates objects, I draw a blank arrow (like →) from my main class to the classes it creates? When do I use a diamond against the arrow?
I'm just curious about these three things ... While an article would also be very helpful, could someone address these three questions?
Thank you very much.
source to share
Do I include the main class in the UML diagram?
There are many types of UML diagrams, but I suspect you are referring to class diagrams here. The answer to your question is literally: if you like. The beauty of the UML is that you can create many diagrams that vary in detail. Some diagrams will show several classes, some of them. The idea is that you draw different parts of the system, from different perspectives, for different audiences. Chart as much or less as you like. If you are doing a very small application with only a few classes, you probably will have to show the meaning of the main class. Give it a stereotype or use a comment that identifies it as the "main application class".
If I include it and it creates objects, I draw an empty arrow (like →) from my main class to the classes it creates?
You can, of course, again "if you want": there will be some kind of dependency: the main class "depends on" other classes because it uses them in some way. That is, if main class A creates objects of class B, then class A needs to compile class B. So you can show this as a dependency if you like.
When do I use a diamond against the arrow?
A diamond shows aggregation or composition and is used as follows: if class A has a class B field, then an arrow from A to B with a diamond on side A is required. The "simple arrow" simply shows a relatively undefined relationship. You can use it from class A to class B when class A uses, somehow class B. Maybe a method of class A is using an instance of class B as a local variable. No containment (composition or aggregation) of B in is implied with a simple dependency.
source to share
It seems that you are not a UML expert, but that is not a problem. I would recommend simply re-arranging the code into class diagrams and then adding your own notes inside a yellow rectangle with a connector associated with whatever you think is important. You will get a graphical representation of your code and will be able to add comments to the value without real UML knowledge.
The UML class diagram is really simple and can cover all the needs of a project. If you don't know UML, just follow the class diagram, change the code and enjoy :-)
source to share