Interaction Diagram An interaction diagram is a graphical representation of interactions between...

21
Interaction Diagram An interaction diagram is a graphical representation of interactions between objects. Sequence diagram: shows the sequence in which activities or behaviors occur Collaboration diagram: shows how the objects are connected statically Each provides a different view of the same interaction

Transcript of Interaction Diagram An interaction diagram is a graphical representation of interactions between...

Page 1: Interaction Diagram An interaction diagram is a graphical representation of interactions between objects. Sequence diagram: shows the sequence in which.

Interaction Diagram An interaction diagram is a graphical

representation of interactions between objects. Sequence diagram: shows the sequence

in which activities or behaviors occur Collaboration diagram: shows how the

objects are connected statically Each provides a different view of the

same interaction

Page 2: Interaction Diagram An interaction diagram is a graphical representation of interactions between objects. Sequence diagram: shows the sequence in which.

Sequence Diagram A sequence diagram shows object interactions

arranged in time sequence. The diagram shows

The objects participating in the interaction The sequence of messages exchanged

The diagram contains Objects with their “lifelines” Messages exchanged between objects in ordered

sequence Focus of control (optional)

Page 3: Interaction Diagram An interaction diagram is a graphical representation of interactions between objects. Sequence diagram: shows the sequence in which.

Sequence Diagram Example Showing the use case of the refuel

class

Page 4: Interaction Diagram An interaction diagram is a graphical representation of interactions between objects. Sequence diagram: shows the sequence in which.

Sequence Diagram … Sequence diagram can be enhanced

by using the scripts. A script is written at the left of a

sequence diagram with the steps of the script aligning with the object interactions.

Scripts can be written in natural language or pseudocode

Page 5: Interaction Diagram An interaction diagram is a graphical representation of interactions between objects. Sequence diagram: shows the sequence in which.

Sample Script

scheduleform a course

get prerequisiteProcess primary courses first, only using alternate courses if needed

Page 6: Interaction Diagram An interaction diagram is a graphical representation of interactions between objects. Sequence diagram: shows the sequence in which.

Collaboration Diagram A collaboration diagram is an alternate way to

represent the messages exchanged by a set of objects

The diagram shows object interactions organised around the objects and their links to each other.

A collaboration diagram contains Objects Links between objects Messages exchanged between objects Data flowing between objects, if any

Page 7: Interaction Diagram An interaction diagram is a graphical representation of interactions between objects. Sequence diagram: shows the sequence in which.

Collaboration Diagram Example Shows the parking use case

Page 8: Interaction Diagram An interaction diagram is a graphical representation of interactions between objects. Sequence diagram: shows the sequence in which.

State Diagram Used to show the life history of a given

class the possible states an object can take the events that trigger the transition from

one state to the next the actions that result from each state

change The state is one of the possible

conditions that it may exist

Page 9: Interaction Diagram An interaction diagram is a graphical representation of interactions between objects. Sequence diagram: shows the sequence in which.

State Diagram Example Black dot: start node Smaller black dot inside a white dot: end node Rectangle: a state Arrow: transition

Page 10: Interaction Diagram An interaction diagram is a graphical representation of interactions between objects. Sequence diagram: shows the sequence in which.

Special States The initial state is entered when an object is

created An initial state is mandatory Only one initial state is permitted The initial state is represented as a solid circle

A final state indicates the end of life for an object A final state is optional More than one final state may exist A final state in indicated by a bull’s eye

Page 11: Interaction Diagram An interaction diagram is a graphical representation of interactions between objects. Sequence diagram: shows the sequence in which.

Events An event is an occurrence that happens at some

point in time The state of the object determines the response to

different events Example:

Adding a student to a course Creating a new course

Page 12: Interaction Diagram An interaction diagram is a graphical representation of interactions between objects. Sequence diagram: shows the sequence in which.

Transitions A transition is a change from an originating state

to a successor state as a result of some stimulus. The successor state could possibly be the originating

states A transition may take place in response to an

event Transactions can be labelled with events

Page 13: Interaction Diagram An interaction diagram is a graphical representation of interactions between objects. Sequence diagram: shows the sequence in which.

Guard Conditions A guard condition is a Boolean expression of

attribute values which allows a transition only if the condition is true.

Page 14: Interaction Diagram An interaction diagram is a graphical representation of interactions between objects. Sequence diagram: shows the sequence in which.

Actions An action is an operation that is associated with

a transition Takes insignificant amount of time to complete Considered to be non-interruptible

Action names are shown on the transition arrow preceded by a slash

Creation OpenRegistration open / Initialise numStudents to 0

Page 15: Interaction Diagram An interaction diagram is a graphical representation of interactions between objects. Sequence diagram: shows the sequence in which.

More Example State diagrams for the fuel and parts

classes

Page 16: Interaction Diagram An interaction diagram is a graphical representation of interactions between objects. Sequence diagram: shows the sequence in which.

More Example … State diagram for the inventory class, orders

parts or fuel: a different condition triggers each state

Page 17: Interaction Diagram An interaction diagram is a graphical representation of interactions between objects. Sequence diagram: shows the sequence in which.

Activity Diagram To model the flow of procedures or

activities in a class A decision node is used to represent a

choice of which activity to invoke

Page 18: Interaction Diagram An interaction diagram is a graphical representation of interactions between objects. Sequence diagram: shows the sequence in which.

Activity Diagram Example An activity

diagram for the inventory class

It may have two decisions to verify that there

is enough fuel to verify that a part

is in stock

Page 19: Interaction Diagram An interaction diagram is a graphical representation of interactions between objects. Sequence diagram: shows the sequence in which.

Package Diagram View the system as a small collection

of packages, which can be expanded to a larger set of classes

Show the dependencies among classes as they belong to different packages

Two items are dependent if changes to the definition of one may cause changes to the other

Page 20: Interaction Diagram An interaction diagram is a graphical representation of interactions between objects. Sequence diagram: shows the sequence in which.

Package Diagram Example There are four major packages The service package consists of five key classes

Page 21: Interaction Diagram An interaction diagram is a graphical representation of interactions between objects. Sequence diagram: shows the sequence in which.

Summary Sequence diagram

Describing scenarios of use cases Interaction diagram

Describing the class• State transition diagram• Activity diagram

Their relationships