You are on page 1of 42

Interaction Diagrams I

Lecture # 4

Department of Computer Science and Technology


University of Bedfordshire
Written by David Goodwin,
based on the book Applying UML and Patterns (3rd ed.)
by C. Larman (2005).

Modelling and Simulation, 2012


Interaction
Outline Diagrams I

Interaction
Diagrams

Interaction Diagrams Communication


Diagrams
information space
stereotypes

Communication Diagrams Example #1


Traceability
information space Procedure

stereotypes Example #2

Example #1
Traceability
Procedure
Example #2
Interaction
Diagrams I

Interaction
Diagrams

Communication
Diagrams
information space
stereotypes
Interaction Diagrams Example #1
Traceability
Procedure
Example #2
Interaction
Interaction Diagrams Diagrams I

Interaction
Diagrams
I Interaction diagrams illustrate how objects interact via Communication
messages. Diagrams
information space
I Used for dynamic object modeling. stereotypes
Example #1
I Two common types: Traceability
I Communication Diagrams Procedure
Example #2
I illustrate object interactions in a graph or network
format; objects can be placed anywhere on the
diagram.
I Sequence Diagrams
I illustrate object interactions in a “fence” format; each
new object is added to the right of the diagram.
Interaction
Interaction Diagrams Diagrams I

Interaction
Diagrams

Communication
I The act of dynamic interaction modeling is incredibly Diagrams

valuable. information space


stereotypes
I Spend time doing dynamic object modeling with Example #1

interaction diagrams, not just static object modeling Traceability


Procedure
with class digrams. Example #2

I need to think of
I What messages to send?
I Messages to whom?
I Messages in what order?
Interaction
Notation - Lifeline Boxes Diagrams I

Interaction
I Lifeline boxes represent the participants in the Diagrams

interaction Communication
Diagrams
I Participants are often instances of a class information space
stereotypes
I Below left; lifeline box representing an unnamed Example #1
Traceability
instance of the class “Sale”. Procedure
I Below right; lifeline box representing a named instance Example #2

of the class “Sale”.


Interaction
Diagrams I

Interaction
Diagrams

Communication
Diagrams

Communication information space


stereotypes
Example #1

Diagrams Traceability
Procedure
Example #2
Interaction
Communication Diagrams Diagrams I

I Information space
I what information a system holds, which describes the
Interaction
system’s internal states Diagrams
I what behaviour a system will adopt, which determines Communication
Diagrams
the state transition information space
I what a system presents to the outside world stereotypes
Example #1
I an object in an information space can play one of three Traceability

different roles, that is, holding information, changing Procedure


Example #2
states, and interfacing
Interaction
Stereotypes Diagrams I

Interaction
Diagrams
I An ‘Analysis Class’ represents an abstraction of one or Communication
more classes and/or subsystems (Use Cases) in the Diagrams
information space
systems design. stereotypes
I Typically you use two modelling techniques, Example #1
Traceability
communication and sequence diagrams to model Procedure
analysis classes. Example #2
I An analysis class can define attributes (if needed).
I An analysis class will include associations.
I An analysis class will consume operations.
I There are three stereotype classes (boundary, control
& entity).
Interaction
semantics Diagrams I

Interaction
Diagrams

Communication
I Semantics Diagrams
information space
I Entity object models information. It holds information stereotypes

and some operations that naturally related to the Example #1


Traceability
information. Procedure
I Boundary/interface object models input and output Example #2

information and operations that process the information.


I Control object models functionality/operations that
process information from several different entity objects.
Interaction
pragmatics Diagrams I

Interaction
Diagrams

Communication
I Pragmatics Diagrams
I Identifying interface objects - functions directly related information space
stereotypes
to actors. Example #1
I Identifying entity objects - information used in a Use Traceability
Procedure
Case and functions of processing information Example #2
I Identifying control object - functions that unite
interface objects and entity objects
I (Carry out the identifications for EVERY use case
defined)
Interaction
boundary classes Diagrams I

I This is a class used to model the interaction between


the system and its actors. Interaction
I The interaction often involves inputs and outputs. Diagrams

Communication
I They clarify and collect information regarding the Diagrams

systems’ boundary (user interface) information space


stereotypes
I Boundary classes represent abstractions of windows, or Example #1
Traceability
other communication interfaces etc. (the computer Procedure

system). Example #2

I Each boundary class should be related to at least one


actor and vice versa.
Interaction
entity classes Diagrams I

I An entity class is used to model persistent data


(information) AND business logic. Interaction
Diagrams
I An entity class is usually not passive.
Communication
I An entity ‘object’ can show changes in Diagrams
information space
data(information). stereotypes
Example #1
I Entity classes often show a logical data structure ready Traceability

for design. Procedure


Example #2
I Entity classes also show what data(information) the
system is dependent upon.
Interaction
control classes Diagrams I

I Control classes represent coordination, sequencing, Interaction


Diagrams
transactions and control of other objects. Communication
Diagrams
I The dynamics of the system are modelled by control information space

classes. stereotypes
Example #1
I Typically they coordinate the movement (parameters) Traceability
Procedure
between boundary and entity classes. Example #2
Interaction
Identifying Analysis Classes Diagrams I

Interaction
Diagrams

Communication
I Examine the models of a Use Case and identify (for a Diagrams
communication diagram): information space
stereotypes
I entity classes by examining the data(information) Example #1

storage requirements of the Use Case. Traceability


Procedure
I one central boundary class for each actor. (primary Example #2
window).
I one control class responsible for handling the control of
the Use Case (and introduce further control classes as
necessary, for example UI handling).
Interaction
‘Architecture’ of a Communication Diagrams I

Diagram

Interaction
Diagrams

Communication
Diagrams
information space
stereotypes
Example #1
Traceability
Procedure
Example #2
Interaction
Return Item Use Case in recycling Diagrams I

machine - example

Interaction
Diagrams

Communication
Diagrams
information space
I Identification of boundary, control and entity stereotypes

stereotypes are often tangled together Example #1


Traceability
I We normally start from the refinement of the Use Case Procedure
Example #2
diagram.
I Then we identify objects.
I At the “same time”, we organise and identify
relationship.
Interaction
Identify boundary/interface objects Diagrams I

I Identify boundary/interface objects from linguistic Interaction


Diagrams
description: looking for key words Communication
Diagrams
“When a customer returns a deposit item, it is measured by information space

the system. The measurements are used to determine what stereotypes


Example #1
kind of can, bottle or crate has been returned. If acceptable, Traceability

the total number of items of this type returned by the Procedure


Example #2
customer increments. If not, the light for “Not Valid” is
highlighted on customer panel.
When the customer presses the receipt button, the printer
prints the date. The total number of items he returned and
the lump sum is calculated. The following is printed out:
customer number, number returned, deposit value, total of
this type and lump sum”
Interaction
Boundary objects Diagrams I

Interaction
Diagrams

Communication
Diagrams
information space
stereotypes
Example #1
Traceability
Procedure
Example #2
Interaction
Identify entity objects Diagrams I

Interaction
Diagrams

Communication
I Identify entity objects from linguistic description Diagrams
information space
I long term information (for all customer): stereotypes
I deposit values of bottle, can and crate Example #1
Traceability
I short term information (for each individual customer): Procedure
I the total number of items of each type returned by the Example #2

customer,
I the total number of items he returned and the lump
sum that should be paid to him,
I date
Interaction
Entity objects Diagrams I

Interaction
Diagrams

Communication
Diagrams
information space
stereotypes
Example #1
Traceability
Procedure
Example #2
Interaction
Identify control objects Diagrams I

Interaction
Diagrams

Communication
Diagrams
I Identify control objects from linguistic description information space
I There are entity and boundary objects in this use case. stereotypes
Example #1
I Items coming from customer panel need to be Traceability
measured and decision on whether passing the Procedure

information and passing what information needs to be Example #2

made according the measurement.


I Decision on whether print out information also needs
to be made.
Interaction
Return Item Use Case in recycling Diagrams I

machine - example

Interaction
Diagrams

“When a customer returns a deposit item, it is measured by Communication


Diagrams
the system. The measurements are used to determine what information space

kind of can, bottle or crate has been returned. If acceptable, stereotypes


Example #1
the total number of items of this type returned by the Traceability
Procedure
customer increments. If not, the light for “Not Valid” is Example #2
highlighted on customer panel.
When the customer presses the receipt button, the printer
prints the date. The total number of items he returned and
the lump sum is calculated. The following is printed out:
customer number, number returned, deposit value, total of
this type and lump sum.”
Interaction
Control objects Diagrams I

Interaction
Diagrams

Communication
Diagrams
information space
stereotypes
Example #1
Traceability
Procedure
Example #2
Interaction
Put everything together Diagrams I

Interaction
Diagrams

Communication
Diagrams
information space
stereotypes
Example #1
Traceability
Procedure
Example #2
Interaction
Return Item Use Case in recycling Diagrams I

machine - example

Interaction
Diagrams

Communication
Diagrams
I Identify the conceptual classes from activity diagram information space
I interface: which activities interface actors? stereotypes
Example #1
I Register is triggered by inserting deposit items Traceability
I Print is triggered by pressing print button Procedure
I Entity: which activities require data? Example #2

I Increment item and increment value count values and


numbers for the 3 types of items
I Calculation requires values and numbers
I Control:
I Passing information is required
Interaction
Activity Diagram Diagrams I

Interaction
Diagrams

Communication
Diagrams
information space
stereotypes
Example #1
Traceability
Procedure
Example #2
Interaction
System specifications Diagrams I

Interaction
Diagrams
I Logical structure of a system, i.e. Communication
Diagrams
I Components information space
I Relationship between components stereotypes

I An OO analysis model shows the logical structure of a Example #1


Traceability
system with a set of analysis classes (objects) and Procedure

associations Example #2

I analysis classes represent “components”,


I association represents relationship.
I The model also shows sub-systems and the relations
between the subsystems
Interaction
Analysis model of recycling machine Diagrams I

Interaction
Diagrams

Communication
Diagrams
information space
stereotypes
Example #1
Traceability
Procedure
Example #2
Interaction
Three subsystems Diagrams I

Interaction
Diagrams

Communication
Diagrams
information space
stereotypes
Example #1
Traceability
Procedure
Example #2
Interaction
Traceability Diagrams I

Interaction
I It shows step-by-step how user’s requirements are Diagrams

satisfied in the course of software development and Communication


Diagrams
where changes are introduced during the lifecycle of a information space

system stereotypes
Example #1

I It is important for being able to trace back when we Traceability


Procedure
want to find places where things go wrong Example #2

I So far, we are able to trace back from OO analysis


model to use case diagram as the OOAM comes from
use cases.
I Traceability needs to be kept on and on in the whole
course of software development
Interaction
What design modeling is about Diagrams I

Interaction
Diagrams

Communication
I Design aims to give a detailed description of a system Diagrams
information space
to facilitate actual coding stereotypes
Example #1
I A design model is required to represent this description Traceability
Procedure
I Actual implementation environment needs to be taken Example #2

into account when building up the design model.


I Functional localisation guarantees that any functionality
change will not influence large part of a system
Interaction
Procedure Diagrams I

Interaction
Diagrams

Communication
Diagrams
I Converting OOAM and refining conceptual classes information space
stereotypes
I Developing sequential diagram to show information flow Example #1

among the classes Traceability


Procedure
I Giving details of each class Example #2

I Showing state transition of each class


I Verifying design
Interaction
Conversion of OOAM Diagrams I

Interaction
I The process of constructing a design model starts from Diagrams

OOAM, to guarantee the logic and traceability Communication


Diagrams
I Conversion: information space

I Change objects, also known as “lifelines” in Visual stereotypes


Example #1
Paradigm, in an OOAM to “blocks” Traceability
I Split a block into several blocks or add more blocks if Procedure
Example #2
necessary
I Traceability - bridging OOAM and OODM enables one
to see how OODM “inherits” system’s logic from
OOAM
I Functional localisation - functionality is restricted in
each block
Interaction
Return Item Use Case in recycling Diagrams I

machine - example

Interaction
Diagrams

Communication
Diagrams
information space
stereotypes
Example #1
Traceability
Procedure
Example #2
Interaction
Take into account of implementation Diagrams I

environment

Interaction
Diagrams

Communication
Diagrams
information space
I Implementation environment stereotypes
Example #1
I Target environment - where system will execute Traceability
I Programming language Procedure

I existing products - e.g. Database Example #2

I Taking them into consideration in design


I Encapsulation - new block will be created
I Component-based design
Interaction
Step 1 Diagrams I

Interaction
Diagrams

Communication
I For one of your use cases identify: Diagrams
I entity classes by examining the data (information) information space
stereotypes
storage requirements of the Use Case. Example #1
I one central boundary class for each actor. (primary Traceability

window). Procedure
Example #2
I one control class responsible for handling the control of
the Use Case (and introduce further control classes as
necessary, for example UI handling).
I By drawing:
Interaction
Step 1 Diagrams I

Interaction
Diagrams

Communication
Diagrams
information space
stereotypes
Example #1
Traceability
Procedure
Example #2
Interaction
Step 2 Diagrams I

Interaction
Diagrams

Communication
I Add links to the diagram. Diagrams
information space
I Links are ‘candidate’ associations. Follow the pattern stereotypes
of: Example #1

I Links from actor(s) to boundary classes (objects); Traceability


Procedure
I Links from boundary classes (objects) to UI handlers; Example #2
I Links from UI handlers to use case controller class
(object);
I Links from use case controller class (object) to entity
classes (objects).
Interaction
Step 2 Diagrams I

Interaction
Diagrams

Communication
Diagrams
information space
stereotypes
Example #1
Traceability
Procedure
Example #2
Interaction
Step 3 Diagrams I

I Add messages to the diagram.


Interaction
I Messages become candidate operations. Diagrams
I The class receiving the message takes ownership of the Communication
operation. Diagrams
information space
I Review your activity diagrams to compile a list of stereotypes
Example #1
interactions that an actor will make with the use case. Traceability
Procedure
I Write a list of interactions and number them. Example #2

I Add the list to the diagram.


I THE DIFFICULT BIT!
I Repeat for each use case!
I example:
1. openApplicantWindowUI
2. openApplicantFormUI
3. submitApplicantForm
Interaction
Step 3 Diagrams I

Interaction
Diagrams

Communication
Diagrams
information space
stereotypes
Example #1
Traceability
Procedure
Example #2

You might also like