You are on page 1of 23

Design Methods

CT015-3-2 Version 1

Interaction Modelling
Topics and Structure of the Lesson

• Interaction Modeling
-Types
-Notations
-Relationships

CT015-3-2 Design Methods Interaction Modeling Slide <2> of 23


Learning objectives

• At the end of this lecture, you should be able


to :
– Describe the purpose and use of
interaction diagrams
– Describe the elements and relationships
in interaction diagrams
– Create sequence and communication
diagrams
CT015-3-2 Design Methods Interaction Modeling Slide <3> of 23
Key Terms

• Communication diagram
• Sequence diagram

CT015-3-2 Design Methods Interaction Modeling Slide <4> of 23


Dynamic Modelling

• Determine how objects interact with each other to


support use case:
– Start with external event from actor
– Determine objects needed to support
use case
– Determine sequence of internal events
following external event
– Depict on communication diagram or
sequence diagram

CT015-3-2 Design Methods Interaction Modeling Slide <5> of 23


Communication Diagram

• Graphically depicts objects interacting with


each other
– Show objects as boxes
– Show their message interactions as arrows
– Show their message interactions as arrows
– Number sequence of messages

CT015-3-2 Design Methods Interaction Modeling Slide <6> of 23


Communication Diagram

Communication
diagram for View
Alarms use case

CT015-3-2 Design Methods Interaction Modeling Slide <7> of 23


Sequence Diagram

• Shows sequence of object interactions in


use case
• Emphasis on messages passed between
objects
– Objects represented by vertical lines
– Messages represented by labeled
horizontal arrows

CT015-3-2 Design Methods Interaction Modeling Slide <8> of 23


Sequence Diagram

Sequence
diagram
for View
Alarms
use case
CT015-3-2 Design Methods Interaction Modeling Slide <9> of 23
Message Sequence Description
• Describes sequence of object interactions
– Narrative description
– Corresponds to Communication Diagram or Sequence
Diagram
• Description corresponds to message sequence
numbering on diagrams
– Describe what object does on receiving message
• E.g., every time an object interacts with an entity object
– Describe the object being accessed
– Identify attributes referenced

CT015-3-2 Design Methods Interaction Modeling Slide <10> of 23


Message Sequence Description
for View Alarms

• A1: The operator requests to view one or more


alarms for example, to view the status of a
factory workstation
• A1.1: Operator Interaction object sends an
alarm request to the Alarm Service
• A1.2: Alarm Service responds - for example,
with information about the requested alarm:
name, description, location severity.
• A1.3: Operator Interaction object formats and
displays the alarm information to the operator.
CT015-3-2 Design Methods Interaction Modeling Slide <11> of 23
Combined Fragments

• Combined fragment is an interaction


fragment which defines a combination
(expression) of interaction fragments.
• A combined fragment is defined by an interaction
operator and corresponding interaction
operands.
• Through the use of combined fragments the user
will be able to describe a number of traces in a
compact and concise manner.
• Purpose: Eliminate repetitive modeling
CT015-3-2 Design Methods Interaction Modeling Slide <12> of 23
Combined Fragments
Fragment type Description
Opt Optional. Encloses a sequence that might or might not happen. You can specify,
in the guard, the condition under which it occurs.
Alt Contains a list of fragments that contain alternative sequences of messages.
Only one sequence occurs on any occasion.

You can put a guard in each fragment to indicate under what condition it can
run. A guard of else indicates a fragment that should run if no other guard is
true. If all guards are false and there is no else, then none of the fragments
executes.
Loop The fragment repeats some number of times. You can indicate in the guard the
condition under which it should repeat.

Loop combined fragments have the properties Min and Max, which indicate the


minimum and maximum number of times that the fragment can be repeated. The
default is no restriction.
Ref Interaction use is interaction fragment which allows to use (or call) another
interaction. Large and complex sequence diagrams could be simplified with
interaction uses. It is also common reusing some interaction between several
CT015-3-2 Design Methods
other interactions. Interaction Modeling Slide <13> of 23
Combined Fragments
Alternative
fragment
box Optional
fragment
box

Interaction use
Loop/iterative / reference
fragment box fragment box

CT015-3-2 Design Methods Interaction Modeling Slide <14> of 23


CT015-3-2 Design Methods Interaction Modeling Slide <15> of 23
Banking System - Validate PIN
Use Case
• ATM Client Objects
– Boundary Objects
• Card Reader Interface
• Customer Interaction
– Entity Objects
• ATM Card
• ATM Transaction
– State Dependent Control Object
• ATM Control
CT015-3-2 Design Methods Interaction Modeling Slide <16> of 23
Communication diagram: ATM Client –
Validate PIN use case – Valid Pin

CT015-3-2 Design Methods Interaction Modeling Slide <17> of 23


Sequence Diagram for Validate PIN use
case – Valid Pin

CT015-3-2 Design Methods Interaction Modeling Slide <18> of 23


Sequence versus Communication
Diagram

CT015-3-2 Design Methods Interaction Modeling Slide <19> of 23


Quick & Review Question

• When would you use a sequence versus a


communication diagram?
• What is an interaction use in a sequence
diagram? Why would you use one?

CT015-3-2 Design Methods Interaction Modeling Slide <20> of 23


Summary of Teaching points

• Interaction Modeling
-Types
-Notations
-Relationships

CT015-3-2 Design Methods Interaction Modeling Slide <21> of 23


Q&A

CT015-3-2 Design Methods Interaction Modeling Slide <22> of 23


What We Will Cover Next

• Finite State Machines

CT015-3-2 Design Methods Interaction Modeling Slide <23> of 23

You might also like