Marlon Dumas Institute of Computer Science

Slides:



Advertisements
Similar presentations
Nested state diagrams:Problems with flat state diagram
Advertisements

Concepts & Notations. Acknowledgements  The material in this tutorial is based in part on: Concurrency: State Models & Java Programming, by Jeff Magee.
Assignments.
1 Chapter 4 Dynamic Modeling and Analysis (Part I) Object-Oriented Technology From Diagram to Code with Visual Paradigm for UML Curtis H.K. Tsang, Clarence.
1 Chapter 4 Dynamic Modeling and Analysis (Part I) Object-Oriented Technology From Diagram to Code with Visual Paradigm for UML Curtis H.K. Tsang, Clarence.
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 5, Analysis: Dynamic Modeling.
1 CS 691z/791z Topics in Software Engineering Chapter 13: Activity Diagrams & Chapter 19: Basic Statecharts [Arlow and Neustadt, 2002] March 8, 2007.
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.
CS451 Introduction to Software Engineering Behavioral Modeling.
State Machine Diagram Chapter 10. State Machine Diagram Used to describe system behavior.
Lecture 4 Finite State Machine CS6133 Software Specification and Verification.
Timed UML State Machines Ognyana Hristova Tutor: Priv.-Doz. Dr. Thomas Noll June, 2007.
Chapter 10 State Machine Diagrams
1 Object-Oriented Modeling Using UML (2) CS 3331 Fall 2009.
Fall 2010 CS4310 Requirements Engineering UML: Dynamic Modeling Dr. Guoqiang Hu Department of Computer Science UTEP 1.
State Modeling.
1 Software Engineering Dr. K. T. Tsang Lecture 8 State modeling
Introduction to Software Testing Chapter 2.5 Graph Coverage for Specifications Paul Ammann & Jeff Offutt
Object-Oriented Modeling Using UML CS 3331 Section 2.3 of Jia 2003.
11 Software Engineering Dr. K. T. Tsang Lecture 9 Advance State Modeling
Executable UML The Models are the Code - Executable UML Lecture 7 - Getting a Lifecycle Paul Krause.
1 State Modeling  Events  States  Transitions and Conditions  State Diagrams  State Diagram Behavior  Practical Tips.
UML Discussion on State Machines Perfectly static system is intensely uninteresting Because nothing ever happens.
1 Graph Coverage (5). Reading Assignment P. Ammann and J. Offutt “Introduction to Software Testing” ◦ Section
Dynamic Models. Outline Dynamic Models Statecharts –States –Transitions –Composite states Interaction Diagrams –Sequence Diagrams The time order of interactions.
State Modeling. Introduction A state model describes the sequences of operations that occur in response to external stimuli. As opposed to what the operations.
CSCI1600: Embedded and Real Time Software Lecture 7: Modeling II: Discrete Systems Steven Reiss, Fall 2015.
State Modeling. Events An event is an occurrence at a point in time, such as user depresses left button or.
States.
CS3773 Software Engineering Lecture 06 UML State Machines.
Digital System Design using VHDL
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.
MCS 270 Spring 2014 Object-Oriented Software Development.
Modeling Object Lifecycles and State-Dependent Behavior ©SoftMoore ConsultingSlide 1.
Dynamic Models - Page L M.E. Fayad Lesson 30: Dynamic Models Object- Oriented Modeling & Application s.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 6: Restaurant.
The Dynamic Analysis Model StateCharts Prof. Hany H. Ammar, CSEE, WVU, and Dept. of Computer Science, Faculty of Computers and Information, Cairo University.
State Modeling. Introduction A state model describes the sequences of operations that occur in response to external stimuli. As opposed to what the operations.
Cliquez pour modifier le style du titre Cliquez pour modifier les styles du texte du masque Deuxième niveau Troisième niveau Quatrième niveau Cinquième.
State transition modeling
Object-oriented and Structured System Models
State Machine Model.
1.3 Finite State Machines.
Marlon Dumas Institute of Computer Science
Finite State Machines Dr K R Bond 2009
Graph Coverage for Specifications CS 4501 / 6501 Software Testing
Advanced state modeling
State Machine Diagrams
UML State Diagrams.
UML Activity Diagrams & State Charts
States.
Object Oriented System Design
CS/CPE 426 Senior Projects
Chapter 10 Object States and The Statechart Diagram
CS310 Software Engineering Dr.Doaa Sami
Chapter 5 state Modeling
Paul Ammann & Jeff Offutt
CS/CPE 426 Senior Projects
Graph Coverage for Specifications CS 4501 / 6501 Software Testing
Dynamic Modeling Lecture # 37.
States.
Interaction Modeling Extracted from textbook:
CSCI1600: Embedded and Real Time Software
Advanced state modeling
CS 791Z State Machines & Advanced State Machines
UML Diagrams: StateCharts The Dynamic Analysis Model
Presentation transcript:

Marlon Dumas Institute of Computer Science State modeling Marlon Dumas Institute of Computer Science

Where are we? Notation Purpose Class diagrams Domain & application modeling Use case diagrams/use cases User-system interaction modeling Sequence diagrams User-system & system-system interaction modeling Statecharts Object behavior modeling Petri nets Concurrent systems & process modeling Decision trees & DMN Decision modeling State modeling -- Luciano García-Bañuelos

Capturing Object Behavior Typically the state of an object changes in response to stimuli (“events”) Scholarship application: A student creates the application (draft) The student can withdraw it (withdrawn) Or the student can submit it (submitted) It can still be withdrawn! A secretary can cancel it because of eligibility rules (cancelled) A committee accepts or rejects it (accepted or rejected) If accepted the student can still withdraw it?! If accepted, the accounting department disburses it (disbursed)

State Machine A machine whose output behavior is not only a direct consequence of the current input, but of some past history of its inputs Characterized by an internal state which represents this past experience If the phone is ON, then pushing this button will turn it off If the phone is OFF, then pushing this button will turn it on

State Machine (Automaton) Transition (event “off”) Initial state (entry)

Another example ON ON OFF OFF

Exercise 1 Model the scholarship application as a state machine The student creates the application (draft) The student can withdraw it (withdrawn) Or the student can submit it (submitted) It can still be withdrawn! A secretary can cancel it because of eligibility rules (cancelled) A committee accepts or rejects it (accepted or rejected) If accepted the student can still withdraw it If accepted, the accounting department disburses it (disbursed)

Actions on the State Machine State changes can induce side-effect actions print(“off”) /print(“off”) Mealy automaton Moore automaton

Extended State Machines State machine with variables c: Integer /c := c + 1

Exercise 2 Consider the state machine of an answering machine Add the following events and actions: Call detected, Answer call, Play announcement, Record message, Caller hangs up, Announcement complete Revise the state machine so that the machine answers after five rings.

Statecharts The statecharts notation extend state machines with: Various types of events and conditions State hierarchy (statecharts inside statecharts) Concurrency Other “cool” features we’ll see… Part of UML Heavily used in SysML

Statecharts: The basics A state model consists of one or more state diagrams State Transition

States A state is an abstraction of attribute values and links of a particular object An object has a finite number of possible states It can only be in one state at a time

Events An event is a “stimulus” that can trigger a state change of an object Kinds of events Call event Signal event Change event Time event

1. Call events A call event represents the reception of a request to invoke a specific operation

2. Signal Event A signal is an explicit one-way transmission of information from one object to another A signal event is asynchronous A call event is a two-way synchronous communication Signal events can be specified as UML classes

3. Change events A change event is an event that is caused by the satisfaction of a boolean expression UML specifies that the expression is continually tested An implementation would not continuously check the expression, but at least often Examples: when (room temperature < heating set point) when (room temperature > cooling set point) when (battery power < lower limit) when (tire pressure < minimum pressure)

4. Time event A time event is an event that is caused by the occurrence of an absolute time or the elapse of a time interval Examples absolute time: at (January 1, 2010) at (20:00) Examples time interval: after (10 seconds) after (10 days)

Guard conditions A transition is the change from one state to another E.g. A phone line transitions from “Ringing” state to “Connected” when somebody picks the phone up A boolean expression can be used to add constraints in the firing of a transition Interesting when more than one transition can be selected at a given time

Transition effects and do-activities Mealy automata actions correspond to UML statecharts’ transition effects A transition effect can be an assignment or the call to an operation UML statecharts can also specify actions attached to state nodes (as for Moore automata) A “do-activity” is an activity that should execute continuously for an extended time

Exercise 3: complete this statechart An order cannot be placed unless the cart is not empty

Entry/Exit Activities An entry activity is performed whenever the state is entered Whenever the state is exited, by any outgoing transition, the exit activity is performed first

Example: Flashing Light Bulb (to be developed in the practice session)

Order of activities After first “off” event print(“exiting”) print(“to off”) turnLightOff() After second “off” event print(“exiting”) print(“needless”) turnLightOff()

Event handling and self-loops In this case “off” event is handled bypassing both the entry and exit activities print(“skipped”)

Readings & Resources Material covered in lectures: This week: Blaha & Rumbaugh, Chapter 5 Next week: Blaha & Rumbaugh, Chapter 6 For the practice sessions: Yakindu StateCharts Tool (SCT) http://statecharts.org/download.html State modeling -- Luciano García-Bañuelos

Exercise 4 (next week) Prepare the state diagram for a washing machine On / Off button Start button (but no stop button) Feedback is given on the current stage (soaking, rinsing, draining, drying) Three washing programs Regular Delicate (no soaking) Super delicate (no soaking, no drying) Off can be clicked only before starting, or after finishing

Exercise 5 (next week) A simple digital watch has a display and two buttons to set it, the A button and the B button. The watch has two modes of operation, display time and set time. In the display time mode, the watch displays hours and minutes, separated by a flashing colon. The set time mode has two submodes, set hours and set minutes. The A button selects modes. Each time it is pressed, the mode advances in the sequences: display, set hours, set minutes, display, etc. Within the submodes, the B button advances the hours or minutes once each time it is pressed. Buttons must be released before they can generate another event. Prepare a state diagram of the watch.