Object State Modeling for Event- Driven Systems Yonglei Tao 1.

Slides:



Advertisements
Similar presentations
Chapter 11 Designing the User Interface
Advertisements

UML State Machine Diagrams and Modeling
State Charts Mehran Najafi. Reactive Systems A reactive, event-driven, object is one whose behavior is best characterized by its response to events dispatched.
Chapter 8 Improving the User Interface
Lexical Analysis (4.2) Programming Languages Hiram College Ellen Walker.
F27SB2 Software Development 2 Lecture 7: State Diagrams.
CH02: Modeling the process and life cycle Process of developing software (organization and discipline in the activities) contribute to the quality of the.
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.
Object-Oriented Analysis and Design
Lecture 6 & 7 System Models.
Modeling State-Dependent Objects Using Colored Petri Nets
THE OBJECT-ORIENTED DESIGN WORKFLOW Statechart Diagrams.
What Is Object-Oriented Design? (Chapter 1). Software Development Life Cycle 1. Problem statement and requirements 2. Solution specification 3. Code design.
UML Sequence Diagrams Eileen Kraemer CSE 335 Michigan State University.
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.
Chapter Day 9. © 2007 Pearson Addison-Wesley. All rights reserved4-2 Agenda Day 8 Questions from last Class?? Problem set 2 posted  10 programs from.
Visualization By: Simon Luangsisombath. Canonical Visualization  Architectural modeling notations are ways to organize information  Canonical notation.
Chapter 5 – System Modeling
Chapter 10 State Machine Diagrams
State Diagrams / System Sequence Diagrams (SSDs)
14 Chapter 11: Designing the User Interface. 14 Systems Analysis and Design in a Changing World, 3rd Edition 2 Identifying and Classifying Inputs and.
System Models Hoang Huu Hanh, Hue University hanh-at-hueuni.edu.vn Lecture 6 & 7.
1 Object-Oriented Modeling Using UML (2) CS 3331 Fall 2009.
Software Engineering 1 Object-oriented Analysis and Design Chap 29 UML State Machine Diagrams and Modeling.
Use Cases 1. Last week  Introduction to software engineering  How is it different from traditional engineering?  Introduction to specification  Operational.
CHAPTER TEN AUTHORING.
Outline Software and Programming Program Structure Tools for Designing Software Programming Languages Introduction to Visual Basic (VBA)
Object-Oriented Modeling Using UML CS 3331 Section 2.3 of Jia 2003.
Ch. 2. Specification and Modeling 2.1 Requirements Describe requirements and approaches for specifying and modeling embedded systems. Specification for.
Sommerville 2004,Mejia-Alvarez 2009Software Engineering, 7th edition. Chapter 8 Slide 1 System models.
Behavioral Modeling Chapter 8.
5 - 1 Copyright © 2006, The McGraw-Hill Companies, Inc. All rights reserved.
Chapter 12: User Interface Design
1 Qualitative Reasoning of Distributed Object Design Nima Kaveh & Wolfgang Emmerich Software Systems Engineering Dept. Computer Science University College.
Dynamic Models. Outline Dynamic Models Statecharts –States –Transitions –Composite states Interaction Diagrams –Sequence Diagrams The time order of interactions.
Smith’s Aerospace © P. Bailey & K. Vander Linden, 2006 State Behavior Patrick Bailey Keith Vander Linden Calvin College.
States.
CS3773 Software Engineering Lecture 06 UML State Machines.
PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 3rd Edition Copyright © 2009 John Wiley & Sons, Inc. All rights.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 26. Review UML behavioral Diagrams – Sequence diagram.
 Engineering Quality Software.  Today o State Diagrams Jerry Kotuba SYST30009-Engineering Quality Software 2.
Essentials of Visual Modeling w/ UML Instructor Notes
Finite State Machines (FSM) OR Finite State Automation (FSA) - are models of the behaviors of a system or a complex object, with a limited number of defined.
Software Quality and Safety Pascal Mbayiha.  software engineering  large, complex systems  functionality, changing requirements  development difficult.
® IBM Software Group © 2007 IBM Corporation Module 3: Creating UML Diagrams Essentials of Modeling with IBM Rational Software Architect, V7.5.
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.
Chapter 7 Behavioral Modeling Brandon A. Jones Stand and Deliver ITEC March 6, 2011.
From requirements to specification Specification is a refinement of requirements Can be included together as Software Requirements Specifications (SRS)
Requirements Specification
UML Diagrams By Daniel Damaris Novarianto S..
Chapter Topics 15.1 Graphical User Interfaces
Software Specification Tools
Dynamic Modeling of Banking System Case Study - II
Graph Coverage for Specifications CS 4501 / 6501 Software Testing
State Machine Diagrams
Lesson 16: State-Based Sequential Design
Princess Nourah bint Abdulrahman University
States.
Unified Modeling Language
Graph Coverage for Specifications CS 4501 / 6501 Software Testing
States.
Chapter 15: GUI Applications & Event-Driven Programming
Chapter 17 Designing Databases
UML Diagrams: StateCharts The Dynamic Analysis Model
Modeling Behavior in Statechart Diagrams
Click “Execute” button.
Chapter 13: Object State Modeling for Event-Driven Systems
Presentation transcript:

Object State Modeling for Event- Driven Systems Yonglei Tao 1

2 Key Takeaway Points  Object state modeling  concerned with the identification, modeling, design, and specification of state-dependent, reactive behavior of objects.  The state pattern  reduces the complexity of state behavior design and implementation, and makes it easy to change.

Microwave Oven Control

Events and Guard Conditions

Composite States

Hierarchical Statecharts

Guidelines  A state name must reflect an identifiable situation  Idle, Waiting for PIN  It must be possible to exit from every state  Cyclic behavior  Do not confuse events and actions

User Interface Design 8  Interaction design  Structure of the dialog between the user and the computer  Visual design  Screen element selection  Screen layout  Visual characteristics of screen elements

Use Case – Process Sale 9

State Machine Diagram 10

Object State Modeling - Validate PIN

12 Object State Modeling Steps

13 Collecting and Classifying State Behavior Information What to look forExampleClassificationRule Something interest happened An online application submitted. EventE1 Mode of operationA cruise control operates in activated/ deactivated modes. StateS2 Conditions that govern the processing of an event Turn on AC if room temperature is high Guard condition G1 An act associates with an event Push the lever down to set the cruising speed. ResponseR1

Constructing a Domain Model 14  The domain model shows relationships between the state dependent software and its context State Machine Source & Destination 1 event 1a event 1b event 2a event 2b event 3a event 3b event 3c resp. 1x resp. 1y resp. 2x resp. 2y resp. 3x Source & Destination 2 Source & Destination 3

A Cruise Control 15

16 Cruise Control Domain Model

17 Constructing a State Transition Table  Constructing the state transition table is optional  It is a systematic approach to state behavior modeling

18 Cruise Control State Transition Table

19 Use of State Transition Tables  A systematic approach to ensure completeness  every state-event combination is analyzed  Easy to detect  dead state  unreachable state  neglected event  impossible transitions  nondeterministic transitions  redundant transitions  inconsistent transitions  Allow to generate state diagrams automatically

20 Converting to State Diagram

21 Cruising Cancelle d Converting Texts to Function Calls leverPulled(), brakeApplied() onOffButtonP ressed() Cruise Deactivated Increasin g Speed Decreasin g Speed onOffButton Pressed() Cruise Activated leverDown()/ setDesiredSpeed(), Cruising leverDown() / setDesiredSpeed() leverReleased()/ setDesiredSpeed() leverUpAnd Hold() leverDown AndHold() leverUp() leverDown AndHold()

22 Implementation of a Control Class  An event in the state diagram implies a call to a method of the class  An instance variable determines the current state of an instance of the class  A method evaluates the state variable and the guard condition, executes the appropriate response actions, and updates the state variable

Update Design Class Diagram 23  Add methods labeling the transitions to the subject class CruiseControl onOffButtonPressed() leverDown() leverUp() brakeApplied() leverDownAndHold() leverUpAndHold() leverPulled() leverReleased() setDesiredSpeed()

The State Pattern  Develop a program that reads a text file (such as proj1.c) and counts  the number of words  the number of symbol sequences in a text  State-dependent behavior  how to process each input character depends on its current state 24

State Diagram 25 symbol

Traditional Approach ch = getchar(); switch (state) { case ‘s’: if ( isalnum(ch) ) { state = ‘w’; wc++; } else case ‘w’: if ( ispuct(ch) ) { } } 26

Using the State Pattern 27

State Objects and Current State :StateS:StateW:StateP State currentState 28

Parsing a Text Line char[] line = new char[Maxsize]; char ch; State currentState = new StateS(); read a line of text into line for (int i=0; i<line.length(); i++) { ch = line[i]; currentState = currentState.Next (ch); } 29

Method Next in State S public State Next (char ch) { if ( Character.isLetterOrDigit (ch) ) { wc++; return new StateW(); } else if (Character.isSpaceChar (ch) ) return new StateS(); else { pc++; return new StateP(); } 30

Method Next in State W Public State Next (char ch) { if (Character.isLetterOrDigit (ch) ) return new StateW(); else if (Character.isSpaceChar (ch) ) return new StateS(); else { pc++; return new StateP(); } 31

Method Next in State P public State Next (char ch) { if (Character.isLetterOrDigit (ch) ) { wc++; return new StateW(); } else if (Character.isSpaceChar (ch) ) return new StateS(); else return new StateP(); 32

Benefits  Isolate behavior that the context object shows in each state  Easy to add/remove a state and to change the behavior of a state 33