As mentioned the aim of a series representation is to define event series, which would have a wanted outcome. The focus is more on the order in which messages occur than on the message in itself. Nonetheless, most of series representations will connect what messages are sent out and also the order in which they tend to happen.
When drawing a sequence layout, bear in mind that lifeline symbols components are placed throughout the top of the representation. Lifelines are depictive of roles or things instances that take part in the sequence being modeled. From a visual point of view, lifelines are shown as a box with a dashed line descending from the facility of the bottom edge. The lifeline's name is put inside package. Furthermore, the lifeline name is highlighted. What this suggests is that the lifeline represents a specific instance of a class in a sequence representation.
For the sake of readability, the first message of a sequence layout always starts at the top and also is located on the left side of the layout. Subsequent messages are then added to the representation a little lower then the previous message. To show an item or lifeline sending out a message to another object, you draw the line to the getting things with a solid arrowhead (if a simultaneous call procedure) or with a stick arrowhead (if an asynchronous signal). The message/method name is positioned above the arrowed line. The message that is being sent to the receiving object represents an operation/method that the getting item's class applies.
When modeling object interactions, there will be times when a problem must be met for a message to be sent to an item. Guards are problems that require to be made use of throughout UML diagrams to manage flow. Bear in mind that a guard might just be designated to a single message. To attract a guard on a series layout, you placed the guard element over the message line being safeguarded as well as in front of the message name, as revealed below.
This sort of elements are utilized to indicate a equally exclusive option that exists in between more that a person message series. Alternatives allow the modeling of the "if after that else" logic (e.g., if you were to get three things, after that you obtain 20% off your purchase; whereas you get 10% off your acquisition). As you can see below, will certainly observe that an alternative combination fragment aspect is drawn using a framework. The word "alt" is positioned inside the frame's name box.
The alternative mix component or piece is made use of to model a series that will happen offered it is offered a particular condition. Otherwise, the sequence does not take place. An choice is usually made use of to model a simplified "if after that" declaration, for example, if there are less than 5 donuts present on the counter, then make two dozen a lot more. The image listed below uses an alternative mix fragment considering that a great deal of messages need to be sent if the student's past due equilibrium is equal to absolutely no. According to the layout, if a pupil's unpaid equilibrium equates to no, then the addStudent, getCostOfClass, and also chargeForClass messages are sent. If the pupil's unpaid equilibrium does not equivalent zero, then the sequence skips sending any one of the messages in the alternative combination piece. We consist of a guard for the alternative; however, the guard is not a called for aspect.
Loops are instead fundamental and very easy to comprehend. This is something that is used when you need to model a repeated series. In UML 2, modeling a duplicating series has actually been boosted with the enhancement of the loophole mix piece. The loophole combination fragment is very comparable in appearance to the option combination fragment. You draw a framework, and in the structure's namebox the message "loop" is put. Inside the structure's material area the loop's guard is placed towards the top left edge, on top of a lifeline.