UML State Diagrams.

Slides:



Advertisements
Similar presentations
State Diagram 1. State diagram: Shows the behavior of one object. They describe all of the possible states that a particular object can get into and how.
Advertisements

State Charts Mehran Najafi. Reactive Systems A reactive, event-driven, object is one whose behavior is best characterized by its response to events dispatched.
Vered Gafni, The Design Language of Statecharts.
Activity Diagrams in UML. Definition Activity diagrams represent the dynamics of the system. They are flow charts that are used to show the workflow of.
ESE Einführung in Software Engineering 7. Modeling Behaviour Prof. O. Nierstrasz.
Introduction to Software Engineering 7. Modeling Behaviour.
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 5, Analysis: Dynamic Modeling.
Ch5: Software Specification. 1 Dynamic modeling using UML  Static models:  Dynamic models:
1 CS 691z/791z Topics in Software Engineering Chapter 13: Activity Diagrams & Chapter 19: Basic Statecharts [Arlow and Neustadt, 2002] March 8, 2007.
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.
Advanced Behavioral Modeling
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.
University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution.
State and Sequence Diagrams Modelling dynamic information So far we have seen: Use Case Diagrams – requirements capture, interface.
CS451 Introduction to Software Engineering Behavioral Modeling.
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.
מידול התנהגותי 1. Today’s Session Sequence Diagrams State Machines 2.
1 Object-Oriented Modeling Using UML (2) CS 3331 Fall 2009.
NJIT Modeling Behavior in State Chart Diagrams Chapter 29 Rafael Mello.
1 Software Engineering Dr. K. T. Tsang Lecture 8 State modeling
Behavioral diagrams Lecture p4 T120B pavasario sem.
Object-Oriented Modeling Using UML CS 3331 Section 2.3 of Jia 2003.
1 Modeling interactions and behavior Lecturer Dr. Mai Fadel.
CSIS3600 System Analysis and Design Statechart Diagrams.
1 A Student Guide to Object- Oriented Development Chapter 7 State Diagrams.
OO Methodology Elaboration Iteration 3 – Part 2 Refining Models.
13-Nov-1513-Nov-1513-Nov-15 State Machines. What is a state machine? A state machine is a different way of thinking about computation A state machine.
Software Engineering Design & Modeling Statechart Diagram.
1 Kyung Hee University Statecharts Spring Kyung Hee University Specifying Objects’ Behaviour  Interaction diagrams show message-passing behaviour.
CSCI-383 Object-Oriented Programming & Design Lecture 12.
Dynamic Models. Outline Dynamic Models Statecharts –States –Transitions –Composite states Interaction Diagrams –Sequence Diagrams The time order of interactions.
Chapter 11 Activity Diagrams. 2 “Activity diagrams are a technique to describe procedural logic, business processes, and work flows” - M. Fowler An activity.
State Modeling. Introduction A state model describes the sequences of operations that occur in response to external stimuli. As opposed to what the operations.
CS212: Object Oriented Analysis and Design Lecture 34: UML Activity and Collaboration diagram.
States.
UML: State Chart Diagrams
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.
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.
Dynamic Models - Page L M.E. Fayad Lesson 30: Dynamic Models Object- Oriented Modeling & Application s.
State Modeling. Introduction A state model describes the sequences of operations that occur in response to external stimuli. As opposed to what the operations.
1 Object Oriented Analysis System modeling = Functional modeling + Object modeling + Dynamic modeling Functional modeling = Use cases Object modeling =class.
SLT User Guide for LDK/GDK System
State Machine Model.
State Machine Diagram.
State Machine Diagrams
Marlon Dumas Institute of Computer Science
Standard UML: Communication and Dynamic Behavior
Dynamic Modeling of Banking System Case Study - I
BM by States class / System
CS251 – Software Engineering Lectures 11 State Diagrams
Princess Nourah bint Abdulrahman University
CSC 422 Kutztown University Dr. Spiegel
UML State machine diagram
States.
Object Oriented System Design
Advanced State Chart diagrams
State Diagrams.
Chapter 5 state Modeling
Marlon Dumas Institute of Computer Science
States.
State Machines 6-Apr-196-Apr-19.
UML State Diagrams.
Modeling Behavior in Statechart Diagrams
State-Transition Diagrams
Using Your Cisco 7940/7960 IP Telephone
Presentation transcript:

UML State Diagrams

UML State Diagrams Describe how an object’s state changes in response to external events Similar to State Transition Diagrams / FSMs Nodes are states Arrows are events/actions/stimulus Ideal for describing behavior of a single object Sequences of states that an object goes through Events that cause a transition from one state to another Actions that result from a state change

State Diagram Key Terms Transition Activity entry, exit, do, entry Action Event State – The current status of an object based upon the total set of events it has responded to so far. Transition – Associations between states. Transitions are fired (taken) based upon events that the object responds to. Activity – Nonatomic sequences of actions that have some duration. (assumed to take time) Action – Atomic executable statements that invoke an operation. (assumed to happen almost instantly) Entry Action – Always performed on entering a state. Exit Action – Always performed when the state is exited. Do Action – Performed continuously as long as the object is in the state Include Action - Invoke the states internal state machine (Do not reference operations). Event – Occurrences that may trigger an object to change states.

State Machine Syntax Name Normal State Activities Start/Initial State Stop/Accepting/Final State Transition EventName [Guard] / Action

Actions vs Activities Actions are associated with transitions, are considered to be processes that occur quickly and are not interruptible Activities are associated with states, can take longer, and can be interrupted by events “do” events can iterate “entry” events happen only on entry to state

Basic State Diagram: Order Entry [Not all items checked] / getNextItem [All items checked && All items available] dispatching checking do/initiate delivery do/check item Item Received [All items available] [All items checked && Some items not in stock] shipped waiting delivered Item Received [Some items not In stock] cancelled cancelled cancelled cancelled

State Diagram with Superstates Active [Not all items checked] / getNextItem [All items checked && All items available] dispatching checking do/initiate delivery do/check item [All items checked && Some items not in stock] waiting Item Received [All items available] Item Received [Some items not In stock] shipped cancelled cancelled delivered

Order Entry With Concurrency Ordering waiting checking shipping authorizing authorized

State Diagram Exercise Draw a statechart diagram modeling a vacuum cleaner robot’s behavior. If activated, it starts vacuuming offices, afterwards the canteen, and finally the laboratory. If it finishes cleaning the laboratory, it starts again in the offices. If deactivated, it returns to its locker and stops there. Every time on changing its operational area, it empties its dust bin into some container. If it runs low on energy, it goes to a recharging station and recharges its batteries. Afterwards it continues the cleaning where it has stopped.

State Diagram Exercise (1) These arrows indicate that when the superstate is entered, the first state reached is “Clean Offices” Problem: when you go to “Charge Robot”, how do you know where to return to?

Encoding “History” Information In Statecharts, sometimes, you’d like to remember “history”, such as when you want to return to a specific state within a substate/superstate. One way to do this is to set/check a variable, and UML lets you do this within activities. But you’d have to do this in each state and add proper transitions. An alternative is to use a “history state”. In such a state, your first entry goes to the state denoted, inside the substate/superstate, with an arrow. On any subsequent entry it is assumed that you return to the state from which you last left.

State Diagram Exercise (2) The “H” indicates that this is a “history” superstate

Basic State Diagram: Order Entry Dial(n) [valid && incomplete] DialTone Dialing Caller lifts handset do/play dial tone do/dial Idle Dial(n) [invalid] Dial(n) [complete] / connect Invalid Connected do/play message busy connected Busy Ringing do/play busy tone do/play ring tone Caller replaces handset

Questions What does the positioning of the “Idle” state and the edges into and out of it indicate? Provide an interpretation of the meaning of and actions associated with the “Dialing” state and the edges out of it. Modify the diagram to indicate that, when the system is in the Connecting state and a busy signal is detected, if the callee has an answering service, the call is directed to the service instead of to a busy tone.