I am doing a UML sequence diagram and I've got like, say, a GUI Controller object who wants to create a new Circle object and then add it to an ActiveDrawables object. Would the diagram in the picture below be correct? Or should I've sent the add() from like the Circle's lifeline (thought this seems kind of weird)?
In code, for example, the Controller would have been the one calling add, like in the picture, but I was having doubts whether I should have sent the message from the Circle's lifeline (though, again, this seems weird).
Of course it depends on your design, but what you have drawn is the usual approach.
The other approach (with Circle contacting ActiveDrawables) is sometimes used as well, e.g.
when all Circles has to be in the same ActiveDrawables,
for efficiency reasons GUIController might pass ActiveDrawables identifier to Circle to create it immediately in ActiveDrawables
if Circle needs to be always attached to ActiveDrawables you may also pass identifier like in previous point
Few things to consider about your diagram:
You don't have to number your messages. It's a technology used in communication diagram rather than in sequence diagram.
The last message seems to be a return (reply) from the previous one. You should use a different arrow for that.
Instead of Circle name the lifeline c1: Circle. Then you'll have an object c1 of type Circle. Then in add operation you can use c1 showing precisely that your passing the newly created Circle object, not just some Circle.
Related
I have drawn an activity diagram to depict my project. Please, could anyone tell whether it is correct or wrong?
The diagram has the following errors:
The start node should be a filled circle (you have an open circle).
The end node should have a filled inner circle, like a bull's eye.
If an action has more than one outgoing arrow, then this means that all outgoing paths are traversed simultaneously. In your case, you want only one path at a time. Use a decision symbol (diamond) in between Login and the subsequent actions.
All actions should have at least one outgoing arrow. This arrow should go back to the decision symbol you forgot to draw (see 3).
The two arrows to the end node mean that the activity ends if both paths have been traversed. In your case, you want the activity to end if either of the paths has been traversed. Use a merge symbol (diamond) for that.
I was reading about statechart diagrams, which are diagrams that model the different states that one or more instances of one or more classes can be.
An object can go from one state to the other through a transition, which is represented using arrow with an event and eventually a action to that event over and respectively below it.
My problem now is that I don't understand exactly what are OR and AND decompositions in a statechart diagram. Could you please give me an explanation (since I've not found around any)?
I would really appreciate a concrete example with the corresponding picture or diagram.
The following picture is an example for an OR. Consider a token traveling from Initial to the Choice (diamond). Here the token travels either to the left or right guided by the constraints which test the condition checked in Choice. From then where they are they next transit through the following unnamed diamond to Continued. You might leave away the joining diamond and draw the transitions directly to Continued.
The AND condition looks like this:
The first Fork(the bar) duplicates the token and sends them to Either and Or. The Join behind these states waits for two tokens to arrive before it sends only one token further to Continued.
Fork and Join use the same symbol. They wait until all incoming tokens arrive and then send as many tokens as there are outgoing transitions. So they are actually some split personality. But mostly they are used the one or the other way.
I'm trying to structure a big diagram by building smaller diagrams and then connect them in the big picture. The problem i got now is that i can't figure out how to add connectors/endpoint to the diagram frame so that i can follow the arrows between the different diagrams.
Would be grateful for some help figuring this out.
You can't do that. A diagram is not an UML object per se. It's a rendering of a number of elements from the model. So you can not connect anything from inside a diagram frame to the outside.
What I did in similar circumstances was that I placed the element in question aside the frame (probably surrounded by a boundary and some explanatory text) from where I show the connectors going somewhere else in that diagram.
The "diagram frame" element type, which you can create by dragging a diagram from the element browser onto another diagram in the main view, is an EA-specific construct that has no basis in UML. Even within EA, they are strange beasts which fall somewhere between proper elements, which are shown in the project browser and can be dragged into any number of diagrams, and "pure" diagram objects which aren't shown in the project browser (such as Notes).
While you can draw connectors from one diagram frame to another in the normal ways, there is no way to create a connector going from an element within one frame, out of the frame's bounds and into another frame. This is because the elements within the frame are not actually present in the diagram which contains the frame; the frame is simply an image of the diagram it refers to.
This question already has answers here:
What do the vertical rectangles convey in a UML sequence diagram?
(2 answers)
Closed 9 years ago.
On a sequence diagram, what does the vertical thin rectangles on the object life line signify ? I could not find a proper answer after searching a lot . Would some one please help me understand this?
Thanks in advance.
It is for displaying one interaction of the object with other object or itself. Interaction needs to be started within that rectangle in the top side and end near bottom side. There is no need to start or end interaction in the top most or bottom most edges in the rectangle. Some also call these as Execution Specifications as well. Have a look at some examples here
Sequence diagram life lines represent different processes or objects that live simultaneously.Lifelines represent only one interacting entity.It is basically a vertical dashed line that represents existence of an object over a period of time.This line disappears when the object is destroyed.As for example see the diagram below:
The data here is an object of type Stock.We can show all the interactions among objects like message exchanges on these lifelines.Just take a look at the diagram below describing interaction between a computer and a server :
Note that the thin vertical rectangles represent execution specification.
Execution specification is a part of object's interaction which represents period of object's lifetime when it is either doing some activity or simply waiting for the reply from other object.
Notation for execution specification is as follows:
I have a question regarding UML Sequence diagram.
Let's say we have an object Customer, KioskUI, KioskService and the KioskService has the last process called showNotification(); does the method showNotification goes to the Customer object or KioskUI?
If KioskUI, does the object have to return a variable to the Customer object as "<----- notification", or we no longer have to return something from the KioskUI to the Customer?
Since sequence diagram only focus on how process operates with one another my other question is, is a tangible object like a printed report is no longer needed to be shown in the sequence diagram or does it have to?
In object oriented systems it is good to see sequence diagrams as depictions of objects sending messages to each to communicate.
Arrows in these diagrams show the sender/receiver relation between objects in time, where the label for the arrow depict the message itself, e.g. a method call with arguments.
You are asking if the backwards arrow should point to KioskUI or the Customer object. The answer is simple, it depends on who sent the message, e.g. where will the method call "showNotification()" return. You have to decide this, but I guess KioskUI is a natural choice.
So the answer is, you should show the backwards arrow to the Customer only if there was an forward arrow from Customer (this should be depicted using the box on the lifeline unless it was an asynchronous call).
What is needed to be depicted in a diagram is always a choice depending on your need and UML makes no difference as long as it is a Classifier I guess, which means anything which can have an instance can be there - classes, components, actors, nodes,... For example I saw many use case realizations done as sequence diagrams with actors as objects with lifelines.