0
1.3kviews
Describe with suitable example, parallel and conditional structured control.

Subject: Object Oriented Modeling and Design

Difficulty: Medium

Marks: 8 Marks

1 Answer
0
8views

A sequence of messages is fine for showing a single, linear sequence, but often we need to show conditionals and loops. Sometimes we want to show concurrent execution of multiple sequences. This kind of high-level control can be shown using structured control operators in sequence diagrams.

A control operator is shown as a rectangular region within the sequence diagram. It has a tag text label inside a small pentagon in the upper left corner to tell what kind of a control operator it is. The operator applies to the lifelines that cross it. This is considered the body of the operator. If a lifeline does not apply to the operator, it may be interrupted at the top of the control operator and resumed at the bottom.

Parallel execution: The tag is par. The body of the control operator is divided into multiple sub regions by horizontal dashed lines. Each sub region represents a parallel (concurrent) computation. In most cases, each sub region involves different lifelines. When the control operator is entered, all of the su bregions execute concurrently. The execution of the messages in each sub region is sequential, but the relative order of messages in parallel sub regions is completely arbitrary. This construct should not be used if the different computations interact. There are very many real-world situations that decompose into independent, parallel activities, however, so this is a very useful operator.

enter image description here

Conditional execution: The tag is alt. The body of the control operator is divided into multiple sub regions by horizontal dashed lines. Each sub region represents one branch of a conditional. Each sub region has a guard condition. If the guard condition for a sub region is true, the sub region is executed. However, at most one sub region may be executed; if more than one guard condition is true, the choice of sub region is nondeterministic and could vary from execution to execution. If no guard condition is true, then control continues past the control operator. One sub region may have a special guard condition [else]; this sub region is executed if none of the other guard conditions are true.

enter image description here

Please log in to add an answer.