Unified Modeling Language UML State diagram Activity diagrams - PowerPoint PPT Presentation

1 / 43
About This Presentation
Title:

Unified Modeling Language UML State diagram Activity diagrams

Description:

... is evaluated continuously until it become 'true' at wich time transition ... If model of an object is design where we wont to remember a sub state from which ... – PowerPoint PPT presentation

Number of Views:169
Avg rating:3.0/5.0
Slides: 44
Provided by: mikeva1
Category:

less

Transcript and Presenter's Notes

Title: Unified Modeling Language UML State diagram Activity diagrams


1
Unified Modeling Language UMLState diagram
Activity diagrams
2
Grouping of diagrams structure, behavior,
implementation and usage
Structure
Implementation
Class Diagram Object Diagram
Package Diagram Component Diagram
Korisniki pogled
  • Sequence
  • Collaboration

Use Case Diagram
Statechart Activity Diagram
Deployment Diagram
Deployment
Behavior
3
Grouping of diagrams by phases
4
Notation in state diagrams and activity diagrams
5
State diagrams (state machine)
  • Describe dynamical behavior of isolated object in
    time, that detects events and react on them
  • Example Click on remote control, change of the
    state of television set from on to other channel
  • Event is called everything that influence an
    object
  • State is set of values of an object (instance of
    a class) with the same response on the events
    that happens to it.
  • Objects in the specific state react on the same
    way on specific event and do the same action

6
State diagrams (1)
  • State diagrams describe state of one object that
    is in transition from one to other state and
    shows start and end state
  • State diagrams (state machines) beside states of
    objects describe also dynamical behavior of use
    case, operations, collaboration and methods.
  • For all this elements, state is step in their
    deployment

7
State diagrams (2)
  • State diagram is graph in which nodes are states
    of one isolated object and arcs are transition
    from one to other state
  • Outside effects are described with events
  • Reaction depends of the state in which object is.
    Possible are actions or change of the state of
    the object

8
State
  • State is described by rectangle with round
    corners, divided in three parts (similar to class
    description)
  • Activities consist of actions and events entry
    (describe what happens when object enter in the
    state), exit (describe what happens when object
    exit the state), do (describe what happens when
    object is in some state)

name
state variable
activity
9
Example fax in idle and sending state
faxing
idle
Date Current date Time Fax start time Phone
NumberOwner Owner Name
Date Current date Time Fax start time Phone
NumberOwner Owner Name
entry/key in remote number exit/complete
transmission do/add datestamp do/add
timestamp do/add phone number do/ add owner do/
pull pages through do/paginate
entry/fax complete exit/begin faxing do/show
date do/show time
10
Details for transition events and actions
  • Description of the events that triggers the
    transition (trigger event) and action that by
    execution enable transition from one to other
    state are added on the line of transition
    (divided by /).
  • Transition from one to other state is possible
    without associated action or event (trigger less
    transition).
  • example

trigger event
Shut down
Turn PC
Initializing
Working
Shutting down
do/Bootup
11
Guard conditions
Shut down
Initializing
Turn PC
Shutting down
Working
do/Bootup
Key stroke or mouse movement
Is time out
Screen saving
  • guard condition
  • (Boolean expression)

12
Event
  • Happens in time and space, but without time
    spending
  • Everything that has consequences is modeled as an
    Event
  • Specific event occurrence is instance of the
    event (event instance) Similarly like class -
    object
  • Event could have parameters, that characterize
    instance of event (as attributes that distinct
    objects from class)
  • Can form hierarchical structure
  • Events are of implicit and explicit types signal
    events calling events transition events time
    events.

13
(No Transcript)
14
Signal event
  • Is named entity that is explicitly intended as a
    communication tool between two objects. The
    reception of a signal is an event of receiving
    object.
  • Signal is asynchronous one way communication
  • To model two way communication multiple signals
    are used (at least one in each direction)
  • Could be defined as classifier with stereotype
    ltltsignalgtgt in class diagrams and parameters
    defined as attributes
  • As classifiers could be defined also as
    generalization

15
Example Signal event defined as generalization
(similarly as classes)
16
Call event
  • Is reception of a call by an object that chooses
    to implement an operation as a state machine
    rather than as a fixed procedure..
  • The receiver chooses whether an operation will be
    implemented as a method or a call event trigger
    in a state machine.
  • The parameters of the operation are parameters of
    the event.
  • Once the receiving object process the call event
    (with taking or failing transition) controls
    return to the calling object.
  • Unlike ordinary calls, the receiver of a call
    event may continue its own execution in parallel
    with the caller.

17
Change event
  • Is satisfaction of the Boolean expression that
    depends on values of certain parameters.
  • This is declarative way to wait until a condition
    is satisfied.
  • It must be used by care, because it represent a
    continuous and potentially non local computation.
  • Difference comparing with guard condition is that
    guard event is evaluated once when the trigger
    event on the transition occurs and the receiver
    handles the event. If it is false transition do
    not ocure. Change event is evaluated continuously
    until it become true at wich time transition
    ocure.

18
Time event
  • Represent the passage of time
  • Could be specified as absolute time (time in day)
    or relative time (time elapsed since given event)

19
Example
20
State
  • Describe a period of time during the life of an
    object of a class. It can be characterized with
    three complementary ways
  • Set of object values qualitatively similar
  • As a period of time during which an object waits
    for some event(s) to occur
  • As a period of time during which an object
    perform some ongoing activity
  • State may have name or can be anonymous. In state
    diagrams states are connected by transitions.
    Transitions are processed by states they leave.

21
Transition
  • Transition that leaves one state define response
    of an object in the state to the occurrence of an
    event
  • In general, a transition has an event trigger, a
    guard condition, an action and a target state.
  • External transition changes the active state. Is
    described with text attached to the transition
    arrow.

22
Types of transition
23
Notation in the state diagrams
24
Trigger events
  • Trigger is an event that enable transition. It
    may have parameters, available to an action on
    the transition.
  • If signal has descendants any its descendant
    enables the transition.
  • Example if transition has MouseButtom as trigger
    MouseButtomDown will also trigger transition
  • An object handles events one in time. A
    transition must be fired at the time object
    handle event the events are not remembered until
    later (except special case of deferred events).
    Events that do not trigger transition are lost
    or ignored

25
Guard condition
  • Transition may have guard condition, which is
    Boolean expression. It may reference attributes
    of the object that owns the state machine, as
    well as parameters of the trigger event
  • It is evaluated when a trigger event occur. If
    condition is true then transition fires, if
    it is false it will not fire.
  • If condition later become true it is late to
    fire transition.
  • If two conflict transitions are enabled at the
    same time, one of them fires non
    deterministically.
  • A transition on a nested states takes precedence
    over transition on one of its enclosing states.

26
Completion transition
  • Transition that lacks an explicit trigger event
    is triggered y the completion of activity in the
    state that it leaves.
  • Action
  • Is executed when transition fires and normally is
    short calculation, assignment statement or
    sequence of short statements, sending signal to
    other object, calling an operation, setting
    return values, creating or destroying objects,
    executed before next event.
  • In practice entering events are placed in queue
    if action is not executed until next event.

27
Kind of actions
28
  • Change of state
  • After the execution of the action the target
    state of transition become active. This may
    trigger exit or entry actions
  • Nested states
  • Are states nested in a given state. A transition
    leaving an outer state is applicable to all
    states nested in it. Transition is eligible to
    fire whenever any nested state is active.

29
Example
30
Composite states
  • Composite state consist of sequential subsets of
    states or concurrent sub states.
  • Decomposition into disjoint sub states is a kind
    of specialization of the state.
  • An outer state is refined into several inner
    states, each of which inherits the transitions of
    the outer state.
  • Only one sequential sub state can be active at
    one time. The outer state represent the condition
    of being in any one of the inner states.

31
(No Transcript)
32
Example
33
Composite state with concurrent sub states
34
History states
  • If it is not stated which of the sub states is
    activated in a composite state, a starting sub
    state will be activated
  • If model of an object is design where we wont to
    remember a sub state from which transition was
    made outside the composite state and we want to
    return to the same sub state after activation of
    the composite state, we will use history state

H
35
Example
After the first entrance in history state there
is no history and beginning is collecting
state If composite state was left in Copying
state when we return to the sub state BackingUp
continuation will be with Copying state
36
Example Complex states and transitions
37
Reusable components
Usage of the state fragments in other state
diagrams with defined name of sub machine
38
Activity diagram
  • Model of dynamical behavior of the system
  • Activity diagram is special form of the state
    machine. It represent flow chart that describes
    change of the control from one to other activity
    (sequential and parallel steps in an process
  • Activity diagram contains states of activities
    (being clauses - commands in procedures).
    Transition is automatic after command is executed
  • Usage imply no interruptions by external events.
    In a case of interruptions better is to use SD

39
  • Activity is non atomic execution in the framework
    of state machine. Result is some action
    containing atomic actions that change state or
    return values
  • Actions (similar to activities) but are atomic
    and do not allow transition during their activity
  • Diagrams can contain also objects
  • AD are important for construction of the
    executable parts of the system in software
    engineering and re-engineering.
  • They are used for modeling flow of one object
    during its change of states in various moments
    of control

40
Activity state
Simple transition
41
Trrigerless transition
guard condition
fork
Flow of values of an object
join
42
Activity state and actions
Text or concrete programming language
43
Organization of the activities according
responsibilities
Write a Comment
User Comments (0)
About PowerShow.com