State Machine Diagrams

Slides:



Advertisements
Similar presentations
State Charts Mehran Najafi. Reactive Systems A reactive, event-driven, object is one whose behavior is best characterized by its response to events dispatched.
Advertisements

UML State chart/machine diagram State machine diagram is a behavior diagram which shows discrete behavior of a part of designed system through finite state.
Interaction Diagrams Activity Diagram State Machine Diagram
SE 555 Software Requirements & Specification 1 Activity Diagrams.
Essentials of interaction diagrams Lecture 23 & 24.
Essentials of state and activity diagram Lecture 24.
State Machine Diagrams (State Chart in UML 1) Specifying Control (ref: Chapter 11 Bennett, Mc Robb and Farmer)
THE OBJECT-ORIENTED DESIGN WORKFLOW Statechart Diagrams.
State Change Modelling. Aim: To introduce the concept and techniques for describing the changes in state that may occur to an object in its lifetime.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 10: Statecharts.
SE-565 Software System Requirements More UML Diagrams.
Unified Modeling Language
State and Sequence Diagrams Modelling dynamic information So far we have seen: Use Case Diagrams – requirements capture, interface.
Lecture 4 Finite State Machine CS6133 Software Specification and Verification.
Chapter 10 State Machine Diagrams
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 8: Modelling Interactions and Behaviour.
Interaction diagrams Sequence and collaboration diagrams.
Guide to State Transition Diagram. 2 Contents  What is state transition diagram?  When is state transition diagram used?  What are state transition.
1 Modeling interactions and behavior Lecturer Dr. Mai Fadel.
UML diagrams What is UML UML diagrams –Static modeoing –Dynamic modeling 1.
Activity diagrams. Introduction ● Activity diagrams are a behavioural model that represent the dynamics of the system. ● An activity diagram is essentially.
7 Systems Analysis and Design in a Changing World, Fifth Edition.
Discovering object interaction. Use case realisation The USE CASE diagram presents an outside view of the system. The functionality of the use case is.
Course Instructor: Kashif Ihsan 1. Chapter # 3 2.
Information System Design IT60105
1 Kyung Hee University Statecharts Spring Kyung Hee University Specifying Objects’ Behaviour  Interaction diagrams show message-passing behaviour.
UML Discussion on State Machines Perfectly static system is intensely uninteresting Because nothing ever happens.
Chapter 11 Activity Diagrams. 2 “Activity diagrams are a technique to describe procedural logic, business processes, and work flows” - M. Fowler An activity.
Object Oriented Analysis & Design & UML (Unified Modeling Language)1 Part VI: Design Continuous Activity Diagams State Diagrams.
CS212: Object Oriented Analysis and Design Lecture 34: UML Activity and Collaboration diagram.
Systems Analysis and Design in a Changing World, Fourth Edition
States.
CS3773 Software Engineering Lecture 06 UML State Machines.
Interaction Diagram An interaction diagram is a graphical representation of interactions between objects. Sequence diagram: shows the sequence in which.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 26. Review UML behavioral Diagrams – Sequence diagram.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 10: Statecharts.
Modeling Object Lifecycles and State-Dependent Behavior ©SoftMoore ConsultingSlide 1.
Communication Diagrams Lecture 8. Introduction  Interaction Diagrams are used to model system dynamics  How do objects change state?  How do objects.
Chapter 7 Behavioral Modeling Brandon A. Jones Stand and Deliver ITEC March 6, 2011.
ITEC1301 Object-Oriented Systems Construction Lecture Notes #4 1.
State Modeling. Introduction A state model describes the sequences of operations that occur in response to external stimuli. As opposed to what the operations.
UML Review: State Machines. Sept. 17, 2003Lecture 5: CS660 Fall Overview States Transitions Activities Modeling object lifeline Creating well-structured.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Advanced UML State Diagrams.
Systems Analysis and Design in a Changing World, Fourth Edition
Activity Diagrams.
UML Diagrams By Daniel Damaris Novarianto S..
State Machine Model.
State Machine Diagram.
TIM 58 Chapter 6, continued: Behavioral Modeling
Object-Oriented Analysis and Design
Unified Modeling Language
Activity and State Transition Diagram
Visit for more Learning Resources
UML Diagrams Jung Woo.
State Machine Diagrams
Princess Nourah bint Abdulrahman University
UML Activity Diagrams & State Charts
UML State machine diagram
States.
Object Oriented System Design
Chapter 10 Object States and The Statechart Diagram
CIS 375 Bruce R. Maxim UM-Dearborn
Interaction diagrams Interaction diagrams are models that describe how groups of objects collaborate in some behavior. Typically, an interaction diagram.
Chapter 5 state Modeling
States.
Chapter 22 Object-Oriented Systems Analysis and Design and UML
CIS 375 Bruce R. Maxim UM-Dearborn
UML State Diagrams.
Appendix 3 Object-Oriented Analysis and Design
Behavioral Diagrams P. P. Mahale
Presentation transcript:

State Machine Diagrams

State machines are well known in industries that use real-time processing. State machine diagrams are used to design and understand time-critical systems, in which the consequences of improper timing are severe. Medical devices, financial trading systems, satellite command and control systems, and weapon systems are typical examples where state machine diagrams can play an important role in understanding how systems behave in reaction to key events. A state machine diagram expresses behavior as a progression through a series of states, triggered by events, and the related actions that may occur. Such state machines are also known as behavioral state machines. State machine diagrams are typically used to describe the behavior of individual objects. However, they can also be used to describe the behavior of larger elements of any system.

State machine diagrams are cousins to activity diagrams State machine diagrams are cousins to activity diagrams. However, state machine diagrams focus on the states and transitions between those states versus the flow of activities. Not every class has significant event-ordered behavior, so we supply state machine diagrams only for those classes that exhibit such behavior. We may also provide state machine diagrams that show the event-ordered behavior of the system as a whole. During analysis, we may use state machine diagrams to indicate the dynamic behavior of the system. During design, we use state machine diagrams to capture the dynamic behavior of individual classes or of collaborations of classes. The two essential elements of a state machine diagram are states and state transitions.

Essentials: Initial, Final, and Simple States At any given point in time, the state of an object encompasses all of its (usually static) properties, together with the current (usually dynamic) values of each of these properties. By properties, we mean the totality of the object’s attributes and relationships with other objects. We can generalize the concept of an individual object’s state to apply to the object’s class because all instances of the same class live in the same state space, which encompasses an indefinite yet finite number of possible (although not always desirable or expected) states. When an object is in a given state, it can do the following: Execute an activity Wait for an event Fulfill a condition Do some or all

Essentials: Transitions and Events The movements between states are called transitions. On a state machine diagram, transitions are shown by directed arrows between states. Each state transition connects two states. While transitions often show how an object moves between states, they may also be recursive, showing an exit from and reentry into the same state. The UML elements described thus far constitute the essential elements of all state transition diagrams. Collectively, they provide a notation sufficient to describe simple, flat, finite state machines, suitable for applications with a limited number of states.

A state-machine diagram is a picture that describes the different statuses (states) of an object and the events and conditions that cause an object to pass from one state to another. The diagram describes the life of a single object over a period of time—one that may span several system use cases. 1 For example, a state-machine diagram might show the different statuses of an insurance claim (Received, Validated, Under Adjustment, Adjusted, Paid, Not Paid, and so on).

In this diagram, a box with rounded corners indicates a state, with a label giving its name. An arrow indicates a transition to another state – the label on the arrow indicates the trigger that causes the transition. A black circle with an arrow coming out of it points to an initial state – a state into which an object can be born. An arrow pointing to a ringed black circle indicates that the source is a final state – a state where an object can end its life.

State: “A state models a situation during which some (usually implicit) invariant condition holds. The invariant may represent a static situation such as an object waiting for some external event to occur. However, it can also model dynamic conditions such as the process of performing some behavior (i.e., the model element under consideration enters the state when the behavior commences and leaves it as soon as the behavior is completed).” A state is a status that an object may have. The object may be in a dormant (static) state, which it exits once an event it is waiting for finally occurs; an example is the state Waiting for Receipt of Proposal, which ends once a proposal has been received. Alternatively, an object may be in an active state, which it exits once activities associated with the state have been completed; an example is the state Under Adjudication, which ends once adjudication activities have been completed.

State machine: “State machines can be used to express the behavior of part of a system. Behavior is modeled as a traversal of a graph of state nodes interconnected by one or more joined transition arcs that are triggered by the dispatching of series of (event) occurrences. During this traversal, the state machine executes a series of activities associated with various elements of the state machine.” A state machine is a model of the statuses through which an object passes; the model describes the events and conditions that cause it to move from state to state and the activities associated with each state. The model may be depicted as a state-machine diagram. A transition is a change of state.

Elements Initial pseudostate : This is shown as a dot on the diagram. It is the start point for the object. The UML classifies this, as well as some other modInitial pseudostate eling elements, as pseudostates rather than states. Pseudostates mark points that transitions may leave from or go to, but they do not represent actual states of the object. Final state : This appears as a bulls-eye. It represents the final state of the object. The final state may be named, and there may be more than one final state for an object. There are a number of restrictions on how you can use the final state : It may not have any outgoing transitions, and you cannot associate specific ehaviors, such as entry, exit, or ongoing activities. Wait state : The object isn’t doing anything important; it is simply waiting for an event to happen or a condition to become true. Ongoing state : The object is performing some ongoing process and stays in this state until some event interrupts the process. For example, a system to manage the work of health inspectors has an inspector state Monitoring Compliance that ends only when management instructs the inspector to discontinue. Finite state : The object is performing some work that has a definite end. Once the work is over, the object passes out of the state.

Transition : A change of state, indicated with an arrow. Event : A trigger that fires—or forces—a transition. To document an event, simply write the event name beside the transition symbol. Transition activity : A quick, uninterruptible activity that happens whenever the transition occurs. To document an activity, precede the activity name with a slash, as in /Assign Temporary Case Number. Send event : A message that is sent to another object whenever the transition occurs. To document a send event, identify the target (the object receiving the request) and the event (or message) that is sent as follows: ^Target.Event. Transition. If you find the notation of a send event cumbersome, or if the diagram is to be presented to business stakeholders, don’t use this feature. Document it as a regular event and clarify who performs the job with a note if necessary. Guard : A condition that must be true for the transition to occur. A guard is somewhat like an event in that both determine whether a transition may occur.

Concurent State If, according to one criterion, an object can be in one of a set of states and, according to another criterion, can be in another state at the same time, use concurrent states to model the object. An object is in concurrent states when it is considered to be in more than one state at the