You are on page 1of 13

OBJECT ORIENTED MODELING

WITH UML

ANALYSIS
Use Case Realization

Analyse a use case


MIS326

Use Case
Use-Case Model
Engineer Analysis Class

Analyse a
Use Case

Supplementary
Requirements

Use Case
Realisation

Spring-910

1
MIS326 What are use case realisations?

1 «trace» 1
use case Place Order Place Order use case
realisation
dependency

 Each use case has a use case realisation


 Use case realisations are parts of the model that show how
analysis classes collaborate together to realise the behaviour
specified by the use case.
 They are a model of how the use case is realised by the
analysis classes we have identified

Spring-910

What Is an Interaction Diagram?


MIS326

 Interaction diagrams show interactions between


objects that realise a use case or part of a use
case
 An interaction diagram shows an interaction,
consisting of a set of objects and their
relationships, including the messages that may
be dispatched among them.
 It models the dynamic aspects of a system.

2
MIS326 Two Types of Interaction Diagrams
 There are two types:
 Sequence diagrams
 These are best for showing a time-ordered sequence of message sends
between objects
 Collaboration diagrams
 These are most useful for showing the structural relationships between
objects
 Collaboration diagrams and sequence diagrams are isomorphic.
 They are each a view onto the same underlying dynamic model and present
the same information but in different ways

Collaboration Diagrams
Sequence Diagrams
Spring-910

Interaction diagrams
MIS326

 Interaction diagrams contain the following


elements
 Objects
 Links
 Messages
 Iteration
 Branching

Spring-910

3
What Is a Sequence Diagram?
MIS326

 A sequence diagram is an interaction diagram


that emphasizes the time ordering of
messages.
 The diagram shows
 The objects participating in the interaction.
 The sequence of messages exchanged.

Sequence Diagrams

MIS326

Spring-910

4
Sequence diagrams
MIS326

:RegistrationManager
Registrar
focus of control
The Registrar addCourse( “UML” )
adds a UML object creation
course. «create»
UML:Course {new}
The Registrar addCourse( “MOOP”)
adds a MOOP
course.
«create»
MOOP:Course {new}
The Registrar removeCourse( “UML” )
removes the
UML course.
«destroy»
message
object
destruction
message flow
comments object lifeline

Spring-910

The Anatomy of Sequence Diagrams


MIS326
Client Object Supplier Object

:Client :Supplier

Object Lifeline
Reflexive Message
1: PerformResponsibility
This is a sample
script.
1.1: PerformAnother
Responsibility
Message

Hierarchical Message
Numbering
Focus of Control

Spring-910

5
Describe Responsibilities
MIS326

How do I find them?


Interaction Diagram

:Client :Supplier

PerformResponsibility

Class Diagram
Supplier

PerformResponsibility

Spring-910

Finding Relationships
MIS326
1: PerformResponsibility

Interaction :Client :Supplier


Diagram
Link
Client Supplier

Class
Diagram Client 0..* 0..* Supplier
Prime suppliers
PerformResponsibility()

Association

Relationship for every link!


Spring-910

6
MIS326 Branching and iteration

:RegistrationManager :Student UML:Course


Registrar

register( “Jim”, “UML”)


findStudent( “Jim” )

object calls itself


*isCalled( “Jim” )

branch of control

[!found] error() [found] register( theStudent )

return
merge of control
Spring-910

MIS326

Spring-910

7
MIS326

Spring-910

What Is a Collaboration Diagram?


MIS326

 A collaboration diagram emphasizes the


organization of the objects that participate in
an interaction.
 The collaboration diagram shows:
 The objects participating in the interaction.
 Links between the objects.
 Messages passed between the objects.

Collaboration Diagrams

8
Objects, links and messages
MIS326

object
message UML:Course {new}
sequence
constraint
number

1: addCourse( “UML” ) 1.1: «create»

2: addCourse( “MOOP”)
:RegistrationManager
message flow
Registrar link
2.1: «create»

object creation
MOOP:Course {new} message

Spring-910

Multiobjects
MIS326

1.1: findStudent( “Jim” )

1: printStudent ( “Jim” )
:RegistrationManager

Registrar
1.2:print() 1.1.1: aStudent = find( “Jim” )

 Multiobjects represent a
students
set of objects aStudent «local»
Course
 Messages sent to a :Student Course
:Student
multiobject go to the
set, not to any individual multiobject
object
Spring-910

9
Iteration
MIS326

iteration
iteration specifier expression

* [i:=1..n] 1.1: printCourse( i )

1: printCourses( )
:RegistrationManager

i
Registrar
qualifier
 Iteration is shown by prefixing 1.2: print()
the sequence number with the
iteration specifier *, and an
Course
optional iteration expression in Course
:Course
square brackets multiobject
 There is no formal UML syntax
for iteration expressions
Spring-910

Branching
MIS326

1.1: findStudent( “Jim” )


[found] 1.2: register(theStudent, “UML” )

1: register ( “Jim”, “UML” )


:RegistrationManager
[!found] 1.3: error ()
Registrar
1.1.1: theStudent = find( “Jim” )
1.2.1: register( theStudent )

 Branching is modelled by
prefixing the sequence
number with a condition.
Course
Course
This is an expression in UML:Course :Student
square brackets
 There is no formal UML
syntax for conditions It’s hard to show branching clearly!!
Spring-910

10
MIS326

Spring-910

MIS326

Spring-910

11
MIS326

Spring-910

One Interaction Diagram Is Not Good Enough


MIS326

Basic Flow Alternate Flow 1 Alternate Flow 2 Alternate Flow 3

AF3
AF1

AF2
Alternate Flow 4 Alternate Flow 5 Alternate Flow n

Spring-910

12
Collaboration Diagrams Vs Sequence
MIS326 Diagrams

 Collaboration Diagrams  Sequence Diagrams


 Show relationships in  Show the explicit
addition to interactions sequence of messages
 Better for visualizing  Better for visualizing
patterns of collaboration overall flow
 Better for visualizing all  Better for real-time
of the effects on a given specifications and for
object complex scenarios
 Easier to use for
brainstorming sessions

Spring-910

Summary
MIS326

 In this section we have looked at use case realisation


using interaction diagrams
 There are two isomorphic types of interaction
diagram
 Collaboration diagrams
 Emphasise the structural relationships between objects
 Sequence diagrams
 Emphasise the time-ordered sequence of message sends between
objects

Spring-910

13

You might also like