interaction diagram an interaction diagram is a graphical representation of interactions between...
TRANSCRIPT
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
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)
Sequence Diagram Example Showing the use case of the refuel
class
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
Sample Script
scheduleform a course
get prerequisiteProcess primary courses first, only using alternate courses if needed
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
Collaboration Diagram Example Shows the parking use case
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
State Diagram Example Black dot: start node Smaller black dot inside a white dot: end node Rectangle: a state Arrow: transition
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
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
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
Guard Conditions A guard condition is a Boolean expression of
attribute values which allows a transition only if the condition is true.
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
More Example State diagrams for the fuel and parts
classes
More Example … State diagram for the inventory class, orders
parts or fuel: a different condition triggers each state
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
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
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
Package Diagram Example There are four major packages The service package consists of five key classes
Summary Sequence diagram
Describing scenarios of use cases Interaction diagram
Describing the class• State transition diagram• Activity diagram
Their relationships