Lecture 09
Lecture 09
Course Leader(s):
Ms.Sahana.P.Shankar
[email protected]
Ms. Supriya, M. S.
[email protected]
1
Faculty of Engineering & Technology © Ramaiah University of Applied Sciences
Lecture Objectives
2 2
Faculty of Engineering & Technology ©Ramaiah University of Applied Sciences
Lecture Topics
• State diagrams
• State chart diagram
• State machine and transitions
• Activity diagram
• Interaction overview diagrams
• Elements in State diagram
• Relationships in State diagram
3 3
Faculty of Engineering & Technology ©Ramaiah University of Applied Sciences
State-chart Diagram
• A State machine
– A behavior that specifies the sequences of states an object
goes through during its lifetime in response to events,
together with its responses to those events
5 5
Faculty of Engineering & Technology ©Ramaiah University of Applied Sciences
State Machine
• A state
– Condition or situation during the life of an object during
which it satisfies some condition, performs some activity,
or waits for some event
• An event
– The specification of a significant occurrence that has a
location in time and space
• An action
– Executable atomic computation that results in a change in
state of the model or the return of a value
• Transition
– Indicates a movement from one state to another
6 6
Faculty of Engineering & Technology ©Ramaiah University of Applied Sciences
Transition
7 7
Faculty of Engineering & Technology ©Ramaiah University of Applied Sciences
Transition
8 8
Faculty of Engineering & Technology ©Ramaiah University of Applied Sciences
State Machine
Graphically
– A state is rendered as a rectangle with rounded corners
– A transition is rendered as a solid directed line
9 9
Faculty of Engineering & Technology ©Ramaiah University of Applied Sciences
State Machine Diagrams
• Internal activities
– To react to events without transition in states
– Putting the event, guard, and activity inside the state box
itself
• An internal activity is similar to a self-transition: a transition
that loops back to the same state
11 11
Faculty of Engineering & Technology ©Ramaiah University of Applied Sciences
Activity Diagram
• Activity diagrams
– Are used in modelling the function of a system
– Emphasize the flow of control among objects
– Collection of vertices and arcs
– A technique to describe procedural logic, business process,
and work flow
– They support parallel behavior (unlike flowcharts)
12 12
Faculty of Engineering & Technology ©Ramaiah University of Applied Sciences
Activity Diagram
13 13
Faculty of Engineering & Technology ©Ramaiah University of Applied Sciences
Activity Diagram
14 14
Faculty of Engineering & Technology ©Ramaiah University of Applied Sciences
Activity Diagram
– Transitions
• To specify the flow of control from one action/activity
state to the next action/activity state
• Represented as a simple directed line
– Objects
• Objects may be involved in the flow of control
associated with an activity diagram
15 15
Faculty of Engineering & Technology ©Ramaiah University of Applied Sciences
Activity Diagrams
• Fork
– A fork has one incoming flow and several outgoing
concurrent flows
• Join
– With a join, the outgoing flow is taken only when all the
incoming flows reach the join
• Decision
– A decision, called branch 1, has a single incoming flow and
two guarded out-going flows
16 16
Faculty of Engineering & Technology ©Ramaiah University of Applied Sciences
Activity Diagrams
• Guard
– Each outbound flow has a guard
– A Boolean condition placed inside square brackets
– Each time you reach a decision, you can take only one of
the outbound flows, so the guards should be mutually
exclusive
• Merge
– A merge has multiple input flows and a single output
– A merge marks the end of conditional behavior started by a
decision
17
Faculty of Engineering & Technology ©Ramaiah University of Applied Sciences
A Simple Activity Diagram
18
Faculty of Engineering & Technology ©Ramaiah University of Applied Sciences
Tokens
• The initial node creates a token, which then passes to the next
action, which executes and then passes the token to the next
• At a fork
– One token comes in, and the fork produces a token on each
of its outward flows
• On a join
– As each inbound token arrives, nothing happens until all
the tokens appear at the join; then a token is produced on
the outward flow
19
Faculty of Engineering & Technology ©Ramaiah University of Applied Sciences
Summary
• State diagrams are good at describing the behavior of an
object across several use cases
• State diagrams are not very good at describing behavior that
involves a number of objects collaborating