0% found this document useful (0 votes)
25 views

Lecture 7

The document discusses UML behavior modeling diagrams. It states that UML provides three diagrams for modeling system behavior: state machines, activity diagrams, and interaction diagrams. It focuses on interaction diagrams, noting there are four types: sequence diagrams, communication diagrams, interaction overview diagrams, and timing diagrams. Sequence diagrams show object interactions over time while communication diagrams focus on object structure. The document provides examples and comparisons of collaboration diagrams, which are similar to communication diagrams, and sequence diagrams. It discusses modeling techniques for conditional messages, iterations, and mutually exclusive paths.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Lecture 7

The document discusses UML behavior modeling diagrams. It states that UML provides three diagrams for modeling system behavior: state machines, activity diagrams, and interaction diagrams. It focuses on interaction diagrams, noting there are four types: sequence diagrams, communication diagrams, interaction overview diagrams, and timing diagrams. Sequence diagrams show object interactions over time while communication diagrams focus on object structure. The document provides examples and comparisons of collaboration diagrams, which are similar to communication diagrams, and sequence diagrams. It discusses modeling techniques for conditional messages, iterations, and mutually exclusive paths.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 32

IS 274: SYSTEM

BEHAVIOUR
Dr. Salome Maro
30th May 2022
RECAP
UML AND BEHAVIOUR
MODELLING
 UML gives 3 diagrams to model system behaviour:
 State machines
 Activity diagrams
 Interaction diagrams
UML AND BEHAVIOUR
MODELLING
 UML gives 3 diagrams to model system behaviour:
 State machines
 Activity diagrams
 Interaction diagrams
UML AND BEHAVIOUR
MODELLING
 UML gives 3 diagrams to model system behaviour:
 State machines
 Activity diagrams
 Interaction diagrams
INTERACTION DIAGRAMS
 UML provides four types of interaction diagrams:
 The sequence diagram, which shows objects interacting along lifelines that
represent general order.
 The communication diagram shows the messages passed between objects,
focusing on the internal structure of the objects.
 The interaction overview diagram treats a sequence diagrams as the unit
for a modified activity diagram that does not show any of the interaction
details.
 The timing diagram shows interactions with a precise time axis.
INTERACTION DIAGRAMS
 UML provides four types of interaction diagrams:
 The sequence diagram, which shows objects interacting along lifelines that
represent general order.
 The communication diagram shows the messages passed between objects,
focusing on the internal structure of the objects.
INTERACTION DIAGRAMS
 UML provides four types of interaction diagrams:
 The sequence diagram, which shows objects interacting along lifelines that
represent general order.
 The communication diagram shows the messages passed between objects,
focusing on the internal structure of the objects.
COMMUNICATION DIAGRAMS
 A.k.a Collaboration diagrams
COLLABORATION
DIAGRAMS
 A Collaboration diagram is a graph showing a number of objects and the links
between them, which in addition shows the messages that, are passed from
one object to another.

 Both collaboration diagrams and sequence diagrams can express similar


constructs

 Different people may prefer one to another


COLLABORATION DIAGRAMS
 The objects are graphically as in sequence diagrams, but they are not placed
across the top of the diagram.

 Objects are placed on the page in a way that best supports showing their
relation to one another

 Messages are shown as lines between the actual objects; therefore, the
messages show how the objects are related to each other.
COLLABORATION DIAGRAMS
COLLABORATION DIAGRAMS
Message

Demo Collaboration

Objects

Objects

Link line

Direction of message
ELEMENTS OF A
COLLABORATION DIAGRAM
Object: The objects interacting with each other in the
system. Depicted by a rectangle with the name of the
object in it, preceded by a colon and underlined. :ObjectName

Relation/Association: A link connecting the


associated objects. Qualifiers can be placed on
either end of the association to depict cardinality.
Messages: An arrow pointing from the commencing
object to the destination object shows the interaction
between the objects. The number represents the
order/sequence of this interaction.
MESSAGES
 Unlike sequence diagrams, collaboration diagrams do not have an explicit way
to denote time and instead number messages in order of execution.
 Sequence numbering can become nested using the Dewey decimal system.
 For example, nested messages under the first message are labelled 1.1, 1.2,
1.3, and so on.

 The condition/guard for a message is usually placed in square brackets


immediately following the sequence number.

 Use a * after the sequence number to indicate a loop.


MESSAGES
1.4 [Condition]: Message name

1.4 *[Loop expression]: Message name


EXAMPLE
An Administrator using a Web Application to manage a user account.
You can follow the process from object to object, according to the outline
below:
1. Find User
1.1 LookUpUser
2. Update User
2.1 ValidateUser
2.2 UpdateUser
EXAMPLE
EXAMPLE COLLABORATION DIAGRAM:
MAKE PAYMENT
direction of message first internal message

makePayment(cashTendered) 1: makePayment(cashTendered)
: Register :Sale

link line 1.1: create(cashTendered)

first message parameter :Payment


creation indicated with a
instance "create" message
HOW TO
READ THE makePayment(cashTendered) 1. The message makePayment is
sent to an instance of Register.
MAKE The sender is not identified.

PAYMENT : Register
2. The Register instance sends the
COLLABOR 1: makePayment(cashTendered)
makePayment message to a Sale
instance.
ATION
DIAGRAM :Sale 3. The Sale instance creates an
instance of a Payment.

1.1: create(cashTendered)

:Payment
MESSAGES TO “SELF” OR
“THIS”
 A message can be sent from an object to itself.
 This is illustrated by a link to itself, with messages flowing along the link.

msg1()

: Register

1: clear()
CONDITIONAL MESSAGES
 A conditional message is shown by following a sequence number with a
conditional clause in square brackets, similar to the iteration clause.
 The message is sent only if the clause evaluates to true.

conditional message, with test

makeNewSale()

1 [ new sale ] : create(cashier)


: Register : Sale
MUTUALLY EXCLUSIVE CONDITIONAL
PATHS (ALTERNATIVES)
unconditional after
either msg2 or msg4 1a and 1b are mutually
:ClassE
exclusive conditional paths

2: msg6()

1a [test1] : msg2()
msg1()
:ClassA :ClassB

1b [not test1] : msg4() 1a.1: msg3()

1b.1: msg5()
:ClassD :ClassC
ITERATION OR LOOPING
 Iteration is indicated by following the sequence number with a star *
 This expresses that the message is being sent repeatedly, in a loop, to the
receiver.
 It is also possible to include an iteration clause indicating the recurrence
values.
runSimulation() 1 * [i:=1..N]: num := nextInt()
: Simulator : Random

iteration is indicated with a * and an optional


iteration clause following the sequence number
COLLABORATION VS.
SEQUENCE DIAGRAMS
Type Strengths Weaknesses
Sequence  Clearly shows sequence or time  Forced to extend to the
Diagram ordering of messages right when adding new
 Simple notation objects; consumes
horizontal space
Collaboration  Space economy – flexibility to  Difficult to see sequence
Diagram add new objects in two of messages
dimensions  More complex notation
 Better to illustrate complex
branching, iteration, and
concurrent behaviour
WHEN TO USE WHICH?
 Choose a communication diagram when the objects and their links facilitate
understanding the interaction.

 Choose a sequence diagram when only the sequence needs to be shown


HOMEWORK: COMPLEX
COLLABORATION DIAGRAMS
A Sales Statistics window (message 1) creates a Statistics Summary object (1.1),
which collects the statistics to display in the window. When the Statistics
Summary object is created, it iterates all salespersons to get the total order sum
(1.1.1) and the budget (1.1.2) for each salesperson. Each salesperson object gets
its order sum by iterating all its orders, getting the amount for each (1.1.1.1), and
adding them together, and gets its budget by getting the amount from a budget
sales object (1.1.2.1). When the Statistics Summary object has iterated all
salespersons, it has been created (the return of message 1.1). The Sales Statistics
window then gets the result lines from the Statistics Summary object (the result
line is a formatted string describing the result of one salesperson) and shows each
line in its window. When all the result lines have been read, the show operation
on the Sales Statistics window returns and the interaction is finished.
UML 2 Book. Page 186 – 187
ASSIGNMENT 3
Using the systems assigned to your groups do the following:
1. Create a state machine for one of the scenarios of using your system
2. Create a sequence diagram for the same scenario
3. Create a corresponding collaboration diagram for the same scenario

Assignment deadline: 6th June 2022 23:59 hours.


READING ASSIGNMENT
 Paper 1: In Practice: UML Software Architecture and Design Description
MENTI: HOW WAS THE TEST?
TEST 2
20TH June 2022 -- Physical

You might also like