Copyright W. Howden1 Lecture 12: State Chart Models.

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

Behavioral Modeling: State Diagrams CIS 4800 Kannan Mohan Department of CIS Zicklin School of Business, Baruch College Copyright © 2009 John Wiley & Sons,
ESE Einführung in Software Engineering 7. Modeling Behaviour Prof. O. Nierstrasz.
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.
5/24/2015CPSC , CPSC , Lecture 71 Software Engineering, CPSC , CPSC , Lecture 7.
Copyright W. Howden1 Lecture 7: Functional and OO Design Descriptions.
Lecture 5a: Sequence Interaction Diagrams CSE 111 Copyright W. Howden1.
Copyright W. Howden1 Lecture 3: Elaboration and System Architecture.
Copyright W. Howden1 Lecture 11: UML Terminology and Additional Models and Notation.
Copyright W. Howden1 Lecture 13: Programming by Contract.
Software modeling for embedded systems: static and dynamic behavior.
Copyright W. Howden1 Lecture 4: Sequence Interaction Diagrams.
Copyright W. Howden1 Lecture 5: Collaboration Diagrams.
System Architecture Lecture 3 CSE 111 Spring /22/20151Copyright William E. Howden.
1 Lecture 2: Elaboration Tasks and Domain Modeling.
Copyright W. Howden1 Lecture 6: Collaboration Diagrams.
Copyright W. Howden1 Lecture 2: Elaboration Tasks and Domain Modeling.
Lecture a: Additional UML Models: Package, Activity, Deployment Lecture b: Generalization, Aggregation and Additional Domain Model Notation Copyright W.
Systems Analysis and Design in a Changing World, 6th Edition
1 KU College of Engineering Elec 204: Digital Systems Design Lecture 20 Datapath and Control Datapath - performs data transfer and processing operations.
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.
Copyright W. Howden1 State Models and the State Pattern.
SE-565 Software System Requirements More UML Diagrams.
State Machine Diagram Chapter 10. State Machine Diagram Used to describe system behavior.
Lecture 4 Finite State Machine CS6133 Software Specification and Verification.
Chapter 10 State Machine Diagrams
State Diagrams / System Sequence Diagrams (SSDs)
Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’
1 Object-Oriented Modeling Using UML (2) CS 3331 Fall 2009.
Business Informatics Group Institute of Software Technology and Interactive Systems Vienna University of Technology Favoritenstraße 9-11/188-3, 1040 Vienna,
08/10/ Iteration Loops For … To … Next. 208/10/2015 Learning Objectives Define a program loop. State when a loop will end. State when the For.
Chapter 12: How Long Can This Go On?
Systems Analysis and Design in a Changing World, 6th Edition
 Application – another name for a program.  Interface – is what appears on the screen when the application is running.  Program Code – is instructions.
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.
Information System Design IT60105
Software Engineering Design & Modeling Statechart Diagram.
1 Kyung Hee University Statecharts Spring Kyung Hee University Specifying Objects’ Behaviour  Interaction diagrams show message-passing behaviour.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Systems Analysis and Design in a Changing World, 6th Edition 1 Chapter 5 INTRODUCTION TO SYSTEMS ANALYSIS AND DESIGN: AN AGILE, ITERATIVE APPROACH CHAPTER.
Disciplined Software Engineering Lecture #12 Software Engineering Institute Carnegie Mellon University Pittsburgh, PA Sponsored by the U.S. Department.
Copyright © 1994 Carnegie Mellon University Disciplined Software Engineering - Lecture 1 1 Disciplined Software Engineering Lecture #12 Software Engineering.
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.
Activity Flow Design Gabriel Spitz 1 Lecture # 12 Guiding the flow of activities.
Algorithmic state machines
GUI testing There are two major sets of GUI testing 1.“Usability” of the GUI Looks (aesthetic, visual appeal) artistic characteristic –Color –Shapes.
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.
UML Activity Diagrams.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 13 How Long Can This Go On?
Programming Logic and Design Fourth Edition, Comprehensive Chapter 14 Event-Driven Programming with Graphical User Interfaces.
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.
1 7 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Chapter 7 The Object-Oriented Approach to Requirements.
State Modeling. Introduction A state model describes the sequences of operations that occur in response to external stimuli. As opposed to what the operations.
Forms Concepts Triggers Fired when Internal/External events occur
Requirements Techniques, cont.
Chapter Topics 15.1 Graphical User Interfaces
Dynamic Modeling of Banking System Case Study - I
State Machine Diagrams
States.
Lecture 4: Sequence Interaction Diagrams
BPMN - Business Process Modeling Notations
REGISTER TRANSFER LEVEL (RTL) DESIGN Using ASM CHART
States.
Chapter 15: GUI Applications & Event-Driven Programming
Presentation transcript:

Copyright W. Howden1 Lecture 12: State Chart Models

Copyright W. Howden2 State Models Components –States: a condition of an object –Events: a state changing occurrence –Transitions: from one state to the next, occur when the associated event occurs

Copyright W. Howden3 Sample State Diagram

Copyright W. Howden4 Consistent and Complete Multiple transitions from a state? –Non-overlapping events (consistency) –Complete set of events Sample state machine –What if dinner time occurs at the same time as the next class time? –What happens after breakfast if there are no classes? –What happens if dinner time event occurs while in class?

Copyright W. Howden5 Augmented Diagrams Constraints/guards needed for better model –Condition(s) added to transition(s) –If event occurs, transition takes place only if condition is satisfied Actions can be added to transitions –Performed if transition takes place Actions on state entry and state exit also

Copyright W. Howden6 Student Example 2

Copyright W. Howden7 State Model Representations Graphical: useful for small systems Tables –State/state or event/state –Better for larger models –Duplicate events and states are obvious –Easier to build up incrementally State variable modification equations

Copyright W. Howden8 State/State Model Table State  State  SleepingDinnerIn Class BreakfastStudying SleepingAlarm DinnerDinnerOver In ClassClassOver [>=DinnerTime & NoMoreClasses] ClassOver [<DinnerTime or MoreClasses] Breakfast Over StudyingDinnerTime [NoMoreClasses] ClassTime

Copyright W. Howden9 Event/State Model Table State  Event  SleepingDinnerIn Class BreakfastStudying AlarmBreakfast BreakfastOverStudying ClassTimeInClass Dinner Over Sleeping ClassOver[<DinnerTime or MoreClasses] Studying; [>= DinnerTime & NoMoreEvents] Dinner Time [NoMoreClasses] Dinner

Copyright W. Howden10 State Equation Models Suppose that x 1 … x n is a set of state variables. Each combination of values is a possible state State variable update equation –shows how a variable is updated for each event Model –list of update equations –state model change when an event occurs go through list in order, executing each equation assume only one event can occur at a time

Copyright W. Howden11 Variable Value Notation State equation variable values –x i is old value of x i –x i ’ is new value of x i Model some “events” using state variables –e.g. dinner time occurring event dt == false and dt’ == true

Copyright W. Howden12 DS State Model Examples ext. events: clocktick, breakfastOver, dinnerOver variables: cl (clock time), dt (dinner time event) di (dinner state) Sample equations for some state variables if (clocktick) then cl’ = cl + 1 (mod 1440) if cl’ = 18:00 then dt’ = true... if (cl’ > 16:30 /*no more classes*/ and dt’) {di’ = true}... dt = dt’ = false; cl = cl’; di = di’

Copyright W. Howden13 State Model Applications System specification and design Class specification –shows the states an object can be in and how the transitions occur as the result of events. Events correspond to messages arriving (or values returned from messages sent). GUI interface design

Copyright W. Howden14 Client Server Model

Copyright W. Howden15 Object State Model - Stack

Copyright W. Howden16 State Models and GUI Interface Design Screens correspond to states –e.g. DS: LogOn, MemberOptions, AdminOptions, DatePrefs, DateeData, etc. Current state = visible screen/dialog Events correspond to user actions –e.g. DS: enter button for LogOn dialog –non-modeled events: mouse movements, screen gets focus, textdata entry, etc.

Copyright W. Howden17

Copyright W. Howden18 State Charts – Additional Notation in DS GUI Example Nested Models Showing transfer of control from nested substates to common superstate –OK Button events in GUI substates to Start/End in higher level state –Entry substate showing which substate is entered when control transits to superstate

Copyright W. Howden19 Additional Notation – Concurrent Sub- models Every submodel has its own set of states, modeled by possible values of its state variable vector Compound model: states correspond to all possible combinations of states of submodels

Copyright W. Howden20

Copyright W. Howden21 Additional Notation – History Substates State A with substates a,b,c,d Entry to state A causes entry to designated substate, say b Exit from state A on some event Re-entry to state A on some event –re-enter at initial substate –re-enter at previous substate, when exit from A occurred: history states option

Copyright W. Howden22

Copyright W. Howden23 State Model Analysis Completeness and consistency of set of transition conditions for a state Necessary problem dependent model properties –e.g. in the DS systems, no matter which state you are in, there is a path of control back to the Start/End state - example of “model checking”

Copyright W. Howden24 State Models and Testing Coverage: every transition should be covered by some test Context based testing: –you are at some state A with an out transition z –there is some previous state B with two transitions x and y that lead to A. Each of these is a context –test z for both x and y, if possible

Copyright W. Howden25 Sequence Diagrams vs State Models Sequence diagrams –used to identify input forms for GUI, etc –show a particular scenario State Model –merges scenarios into inclusive model –gives complete picture of order in which things can occur

Copyright W. Howden26 State Model Pitfalls Too detailed Badly drawn/organized –need for state model tool Not really a state model, but a flow chart –states are actions and transitions are conditions on existing values, like a control flow diagram Transitions should be made on the occurrence of events

Copyright W. Howden27 DS Bad State Chart

Copyright W. Howden28 Comments on Bad State Chart DS State Chart State: presenting user with opportunity to enter data as input Event: button pushed indicating data entered. Constraint: based on state variables DS Flow Chart Action: procedure carried out in the system on data Action terminates: flow leaves action along some transition Condition: based on state variables

Copyright W. Howden29 Terminology Modal versus Modeless classes/objects Modal Object behavior depends on state e.g. modal dialog boxes: if include data entry, cannot terminate/exit before input is done Modeless Behavior (e.g. of method calls) not dependent on state, no need for state model External and events and state models External From outside model or submodel (e.g. events on state model transitions). State charts are event- driven.