Professional Documents
Culture Documents
Activity diagram
Activations->
3 : validate member
T : Transaction
4 : check number of books issued
5 : book can be issued
6 : <<create>>
7 lift
12receiver
callee hangs up
: Callee
Choosing between sequence and collaboration
Sequence diagram are better choice :-
When we want the reader to be able to easily see
the order in which messages occur.
When we want to build an interaction model from
a use case. Use cases already have a sequence of
steps. Sequence diagrams expands on these to
show which objects are involved
Collaboration diagram are better choice:-
When we want to build an interaction model from
a class diagram since they effectively show
instances with communication links.
They can also be used to help in validation of class
diagram
Activity Diagram
“Activity diagram is a dynamic model which
shows the activity and the event that causes
the object to be in the particular state”
Activity diagrams do not give details about
how objects behave or how objects
collaborate. They shows the effect of external
events on internal processing.
Activity diagrams are useful for analyzing a
use case by describing what actions needs to
take place and when they should occur.
Elements of Activity diagram
Initial Activity:- It shows the starting point or
first activity of the flow and denoted by a solid
circle. There can be only one initial state in a
diagram.
[opt1] [opt2]
Synchronization bar[ fork and join]:-
Activities can be done in parallel. To split
processing (“fork”), or to resume processing
when multiple activities have been
completed( “join”), synchronization bars are
used.
Close Order
Modeling Workflow (Swim lanes)
Workflows represent the flow of work and objects
through the business. We can use activity diagrams to
model a workflow.
If we wish to distinguish in an activity diagram, the
activities carried out by individual actors, then we
draw swim lanes.
Firstly the vertical columns are made, separated by
thick vertical black lines, and name each of these
columns with the name of the actor involved.
Place the activities below the actor performing these
activities and then show how they are connected.
Customer Sales Stockroom
Request Service
Take
Order
Pay Bill
Fill Order
Collect Deliver
Order Order
Modeling a Workflow
State Diagram
“State diagram represents the pattern of events, states,
and state transitions for a given class”
It is a graph whose nodes are states and whose
directed arcs are transitions labeled by event names. If
more than one transition leaves a state, then the first
event to occur causes the corresponding transition to
fire. If an event occurs that has no transition leaving
the current state, then the event is ignored.
A state diagram describes the behavior of a single
class of objects. Since all instances of a class have the
same behavior, they all share the same state diagram.
Events:- An event is something that happens at a point in
time. It can be defined as individual stimulus from one object
to another such as user depresses left button. They have no
time duration.
Two events that are causally unrelated are said to be
concurrent; they have no effect on each other. In modeling a
system they can occur in any order.
An event is a one-way transmission of information from one
object to another. It is not like a subroutine call that returns a
value. We group all the events into event classes and give each
event class a name to indicate common structure and behavior.
Some classes of events may be simply signals that something
has occurred, while other classes of events convey data values
or the event attributes.
Ex-Flight departs( airline, flight number, city), input string
entered( text), digit dialed( digit)
States:- The attribute values and links held by
an object are called its state. Set of values are
grouped together into a state according to properties
that effect the gross behavior of the object.
A state specifies the response of the object to input
events. The response may include an action or change
of state by the object.
Ex-If a digit is dialed in state ‘dial tone’, the phone
line drops the dial tone and enters state ‘dialing’.
A state has duration; it occupies an interval of time.
A State can be specified by a name and a description
of its purpose. An event sequence can also be added
that leads to the state.
Scenarios:-
A scenario is a sequence of events that occurs during one
particular execution of a system. It may include all events
in the system or it may include events generated by
certain objects in the system.
Ex- scenario for using a telephone line is:-
caller lifts receiver
dial tone begins
dial digits
……
phones are disconnected
Caller hangs up
Event trace diagrams:-
After writing a scenario we identify the sender and receiver
objects of each event. The sequence of events and the objects
exchanging events can both be shown in an augmented
scenario called an event trace diagram.
Caller Phone line
Callee
caller lifts receiver
dial tone begins
……….
………….
connection broken connection broken
caller hangs up
Conditions:- A condition is a Boolean
function of object values which remains valid
over an interval of time.
Conditions can be used as guards on
transitions. A guarded transition fires when its
event occurs, but only if the guard condition is
true.
A guard condition is shown as a Boolean
expression in brackets following the event
name.
[ guard condition]
Operations:- Operations attached to states or transitions
are performed in response to the corresponding states or events.
An activity is an operation that takes time to complete.
Activities include continuous operations and sequential
operations. The notation “ do :A” within a state box indicates
that activity A starts on entry to the state and stops on exit.
An action is an instantaneous operation. An Action is
associated with an event.
Actions can also represent internal control operations, such as
setting attributes or generating other events.
State 1
event1 (attribs) [condition1] / action1 State 2
Do: activity1 …….
Interface formats