2k likes | 2.01k Views
Learn how to effectively utilize interaction diagrams in UML to showcase communication between objects, focusing on specific messages to realize functionality. Explore sequence diagrams and various notations for detailing interactions. Enhance your understanding of elements, messages, execution occurrences, state invariants, and combined fragments for comprehensive modeling.
E N D
UNIT 3 UNIT 3 • DYNAMIC MODELING Coming up: Interaction Diagrams
INTERACTIONS • Interaction diagrams are defined by UML to emphasize the communication between objects, not the data manipulation associated with that communication. • Interaction diagrams focus on specific messages between objects and how these messages come together to realize functionality. • Interaction diagrams show exactly how those objects will realize it. Coming up: Interaction Diagrams
You can show the details of an interaction using several different notations; however sequence diagrams are by far the most common. Other notations include interaction overviews, communication diagrams, timing diagrams Coming up: Interaction Diagrams
1. Participants • Objects who participate in the communication. • Shown by a Rectangle.
EXAMPLE : Order Processing System : User ObjectName:ClassName
2. Lifeline Coming up: Interaction Diagrams
3. Messages • Shown as a solid line pointing from the sender's lifeline to the receiver's lifeline.
3.1 Synchronous Message • If a message represents synchronous communication ( meaning the sender waits for the receiver to process the message), • You place a filled arrow head on the receiver's end.
3.2 Asynchronous Message • If the message is an asynchronous message (meaning the sender doesn't wait for the receiver to process the message), • You place an open arrowhead on the receiver's end of the line.
Types of Messages Class 2 Class1
3.3 Return values • Using a dashed line with an open arrowhead.
Type of Message ::: Elements : Order Processing System : User OrderItem (“UML in a Nutshell”) Confirmation Number
More About Scenario …. • Sequence Diagrams show how objects interact with each other and the order of occurrence. • They represent interactions for a particular scenario.
FROM USECASE DIAGRAM TO SEQUENCE DIAGRAM • Refine and expand each use case…
Create / Destroy Objects: Coming up: Interaction Diagrams
TYPES OF MESSAGES • SYNC, ASYNC • Lost and Found Coming up: Interaction Diagrams
Found Message • You show a found message by starting the message from a black circle rather than the sender's lifeline. Coming up: Interaction Diagrams
The CircuitBreaker doesn't care where the power surge came from; it must terminate the power in all conditions. Coming up: Interaction Diagrams
Lost Message Coming up: Interaction Diagrams
4. EXECUTION OCCURRENCE • You can show an object is involved in executing some type of action (typically a method call) for a measurable amount of time using an execution occurrence. • Execution occurrences are shown as gray or white rectangles on a lifeline. • In practice, it is common to hear execution occurrences called "focus of control," Coming up: Interaction Diagrams
5. STATE INVARIANT • UML allows you to place labels along a lifeline to convey conditions that must be true for the remainder of the interaction to be valid. • These conditions are called state invariants . • State invariants are typically boolean expressions, Coming up: Interaction Diagrams
6. COMBINED FRAGMENT • 1. Critical • 2. Alt • 3. Opt • 4. Parallel • 5. Loop Coming up: Interaction Diagrams
Interaction Operator • Combined Fragment Coming up: Interaction Diagrams
1. Critical • You may have a critical region within your interaction where a set of method calls must execute atomically Coming up: Interaction Diagrams
2. Alt • alternative interaction operator that models an if-else condition Coming up: Interaction Diagrams
3. Opt • Options are interaction fragments that executes only if the guard condition is True. • The interaction operator is opt. Coming up: Interaction Diagrams
4. Break • A break indicates that the associated interaction fragment operand should execute and then terminate the enclosing interaction. Coming up: Interaction Diagrams
5. Parallel • Parallel indicates that the associated interaction fragments may be merged and executed in parallel. The interaction operator is par. • UML specifies that the actual interleaving of the event occurrences of the operands must be done in such a way that the ordering in the original operand is maintained. Coming up: Interaction Diagrams
For example, if the first operand consists of: • Step1 • Step2 • Step3 • and the second consists of: • StepA • StepB • StepC Coming up: Interaction Diagrams
they can be merged into: Step1 StepA StepB Step2 StepC Step3 but not into: Step1 StepB Step2 StepA Step3 StepC Coming up: Interaction Diagrams
6. Loop • A loop indicates that the contained event occurrences are to be executed some number of times. • The interaction operator is loop. The notation for a loop includes a minimum and • maximum number of times a loop should execute. Coming up: Interaction Diagrams
6. COMBINED FRAGMENT • 1. Critical • 2. Alt • 3. Opt • 4. Parallel • 5. Loop Coming up: Interaction Diagrams
7. INTERACTION OCCURRENCE Coming up: Interaction Diagrams
8. CONTINUATIONS • Typically used with interaction references, continuations allow you to define different branches of an alternative interaction outside of the alternative itself. • Only on those specific lifelines. Coming up: Interaction Diagrams