State Machine and Activity Diagrams - PowerPoint PPT Presentation

1 / 16
About This Presentation
Title:

State Machine and Activity Diagrams

Description:

State machine diagrams show the behavior of the class/subsystem in response to external stimuli. ... processes by which the class or subsystem changes behavior. ... – PowerPoint PPT presentation

Number of Views:52
Avg rating:3.0/5.0
Slides: 17
Provided by: harry66
Category:

less

Transcript and Presenter's Notes

Title: State Machine and Activity Diagrams


1
State Machine and Activity Diagrams
  • University of Sunderland

2
Purpose
  • Sequence and collaboration diagrams are often
    insufficient to describe the full behavior of a
    class or subsystem. State machine and activity
    diagrams may also be required. These are based on
    Petri Nets.
  • State machine diagrams show the behavior of the
    class/subsystem in response to external stimuli.
  • Activity diagrams show the behavior of the the
    class/subsystem in response to internal
    processing.

3
State Machine Diagram Notation
  • Describes the states an object can have during
    its lifecycle, the behaviour in those states, and
    the events that can cause the state to change.
  • Statesrepresenting the distinct behaviors of the
    class or subsystem. Often represented by state
    objects.
  • Transitionsthe processes by which the class or
    subsystem changes behavior.

4
Technique for Construction
  • Specify the class or subsystem
  • Identify the distinct behaviors of the
    subsystem/class/object
  • Identify the circumstances under which the
    behavior may change
  • Define the types of transitions between behavior.
  • Iterate

5
Sample State Machine Diagram
Splitting of Control
Initial State
State1
State3
State
State2
Transition
Final State
Joining of Control
6
States
  • May be active or inactive
  • May have an internal state machine
  • May be composed of multiple state machines.
  • May be initial
  • May be final
  • May have a memory (history)
  • May generalize other states

7
Transitions
  • Are paths relating two states or a state and a
    splitting/joining of control.
  • May iterate, returning to the same state.
  • May be associated with logical conditions
  • May be periodic or may have an associated time.
  • May be compound
  • May be protected by guard conditions.

8
Splitting/Joining of Control
  • Represent when multiple concurrent threads are
    created from one or when threads are
    synchronized.
  • You can also send messages between state machines.

9
Events
  • Classes that define triggers of state changes
  • For internal state transitions
  • May be entry events, associated with the entry
    into a state.
  • May be exit events, associated with exit from a
    state.
  • May call other state machines (do events)
  • Events (signal and call events) may invoke
    operations (actions).
  • May reflect condition changes (condition events)
    or times (time events).

10
Activity Diagram Notation
  • Similar to state machine diagrams
  • Contain swimlanes associated with individual
    subsystems, classes or objects that are
    interacting in the activity.
  • Elements include
  • Swimlanes
  • Action states
  • Action flows
  • Object flows

11
Purposes of Activity Diagrams
  • To capture workflow
  • To show how related actions can be performed,
    affecting objects around them
  • To show how a use case can be performed in terms
    of actions and object state changes
  • To model a business or organization

12
Technique for Construction
  • Identify the subsystem or class
  • Model swimlanes
  • Model action states
  • Model action flows
  • Model object flows
  • Iterate

13
Sample Activity Diagram
Class1
Class2
Class3
Responsible Object
Action Flow
State1
State2
Action State
State3
OClass2
Swimlane Border
Object Flow
14
Swimlanes
  • Used to associate various actions with the
    responsible objects
  • Contain activities and action states

15
Action States
  • Atomic actions or operations
  • Contents may be a statechart
  • Need not be unique

16
Flows
  • Action flows are associations between action
    states
  • Object flows show the transfer of objects between
    action states.
  • Can include decisions
  • Can use pins to model inputs and outputs.
Write a Comment
User Comments (0)
About PowerShow.com