K. Stirewalt CSE 335: Software Design Administrivia Homework #7 on web –A “tour” rather than a working project –Please look through it and try to understand.

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

Concepts & Notations. Acknowledgements  The material in this tutorial is based in part on: Concurrency: State Models & Java Programming, by Jeff Magee.
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.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 12Slide 1 Software Design l Objectives To explain how a software design may be represented.
Concurrency: introduction1 ©Magee/Kramer 2 nd Edition Concurrency State Models and Java Programs Jeff Magee and Jeff Kramer.
ESE Einführung in Software Engineering 7. Modeling Behaviour Prof. O. Nierstrasz.
Introduction to Software Engineering 7. Modeling Behaviour.
© 2006 ITT Educational Services Inc. SE350 System Analysis for Software Engineers: Unit 9 Slide 1 Appendix 3 Object-Oriented Analysis and Design.
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.
5/24/2015CPSC , CPSC , Lecture 71 Software Engineering, CPSC , CPSC , Lecture 7.
Embedded Systems Details. Object Model: Four main system objects or classes Controller object might be made up of several controllers is the brains of.
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 5, Analysis: Dynamic Modeling.
THE OBJECT-ORIENTED DESIGN WORKFLOW Statechart Diagrams.
Advanced Behavioral Modeling
K. Stirewalt CSE 335: Software Design Administrivia Last homework will be #9, assigned later this week –Thus, need to complete 7 of 9 rather than 8 of.
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.
An Introduction to Rational Rose Real-Time
Unified Modeling Language(UML) BY
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
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,
E. Kraemer CSE 335: Software Design Software Architecture and Larger System Design Issues Lecture 5: Finite state modeling and analysis Topics: –Using.
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
E. Kraemer CSE 335: Software Design Software Architecture and Larger System Design Issues Lecture 6: Advanced state modeling/analysis Topics: –Modeling/analyzing.
Behavioral diagrams Lecture p4 T120B pavasario sem.
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.
1 State Modeling  Events  States  Transitions and Conditions  State Diagrams  State Diagram Behavior  Practical Tips.
1 Qualitative Reasoning of Distributed Object Design Nima Kaveh & Wolfgang Emmerich Software Systems Engineering Dept. Computer Science University College.
Information System Design IT60105
SWT - Diagrammatics Lecture 4/4 - Diagramming in OO Software Development - partB 4-May-2000.
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.
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.
Object Oriented Analysis & Design & UML (Unified Modeling Language)1 Part VI: Design Continuous Activity Diagams State Diagrams.
OMT Modeling 1. Object Model : presented by the object model and the data dictionary. 2. Dynamic Model: presented by the state diagrams and event flow.
State Modeling. Events An event is an occurrence at a point in time, such as user depresses left button or.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 UML State Diagrams.
States.
CS3773 Software Engineering Lecture 06 UML State Machines.
Dynamic Modeling Grady Booch, James Rumbaugh, and Ivar Jacobson, The Unified Modeling Language User Guide, 2 nd edition, Addison Wesley, 2005.
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.
MCS 270 Spring 2014 Object-Oriented Software Development.
Modeling Object Lifecycles and State-Dependent Behavior ©SoftMoore ConsultingSlide 1.
2/25/2016COSC , Lecture 191 Real-Time Systems, COSC , Lecture 19 Stefan Andrei.
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.
State Modeling. Introduction A state model describes the sequences of operations that occur in response to external stimuli. As opposed to what the operations.
Concurrency/synchronization using UML state models November 27th, 2007 Michigan State University.
Chapter 4 – Thread Concepts
Marlon Dumas Institute of Computer Science
Chapter 4 – Thread Concepts
Concurrency/synchronization using UML state models
State Machine Diagrams
Software Architecture and Larger System Design Issues
Software Architecture and Larger System Design Issues
UML Activity Diagrams & State Charts
States.
Chapter 5 state Modeling
Marlon Dumas Institute of Computer Science
States.
CHAPTER 2 Object-Oriented Modeling Using UML (Continued)
Appendix 3 Object-Oriented Analysis and Design
Presentation transcript:

K. Stirewalt CSE 335: Software Design Administrivia Homework #7 on web –A “tour” rather than a working project –Please look through it and try to understand it before Wednesday if at all possible Project #3 will be introduced in class on Wednesday. Please be sure to attend.

K. Stirewalt CSE 335: Software Design Software Architecture and Larger System Design Issues Lecture 5: Finite state modeling and analysis Topics: –Using finite-state modeling to reason about a high level design prior to implementation –Introduction to UML State Diagram notation –Chapter 5 in Blaha and Rumbaugh

K. Stirewalt CSE 335: Software Design Motivation and overview Some objects in a system have complex temporal behaviors, which must be carefully designed –E.g., modern interactive and distributed applications Typically comprise multiple active objects Use locking primitives to synchronize threads –E.g., embedded systems where software controls devices Devices run “in parallel” with controller Communicate with one another by signalling Design problems: –e.g., race conditions and synchronization anomalies –e.g., lost or unexpected signals, deadlock Issue: How to design to prevent these problems

K. Stirewalt CSE 335: Software Design Concrete example Starter interface Shift-lock actuator Software controller Remote interface to engine from engine

K. Stirewalt CSE 335: Software Design Potential problems in such systems Controller enters a state in which it is no longer receptive to signals from its environment –Signals may arrive but have no effect –Controller may prevent issuing of signals e.g., greying out of buttons in a graphical dialog box Controller enters a state in which it is receptive to some signals, but not those that are being offered by the environment Controller expects some peer to be in a state that is ready to receive a signal, sends the signal, but the peer isn’t ready

K. Stirewalt CSE 335: Software Design Problems (continued) The bad news: Most of these problems cannot be reliably detected and fixed via testing –Some are “race conditions” Depend on how the various actors are scheduled by OS Difficult to reproduce Instrumentation (for diagnosis) may make them go away! –Very difficult to simulate all possible interactions with an environment Often we test our programs under lots of assumptions about how they will be used These assumptions often turn out to be naive

K. Stirewalt CSE 335: Software Design Current state of the practice... Relies on “designing out” these problems rather than trying to uncover and reproduce them after the fact Aided by finite state modeling and analysis of software architectures –Model each entity in the system as a communicating finite state machine –Simulate interactions between state machines, looking for flaws Model checking: Attempts to exhaustively analyze a system specified in this fashion

K. Stirewalt CSE 335: Software Design Finite-state models Describe temporal/behavioral view of a system Specify control: –Sequence operations in response to stimuli –Distinguish states, events, and transitions –Especially useful during design Lots of variants: –E.g., StateCharts, UML state diagrams –E.g., FSP (textual notation)

K. Stirewalt CSE 335: Software Design Key terms Event: occurrence at a point in time –instantaneous –often corresponds to verb in past tense e.g., alarm set, powered on –or onset of a condition e.g., paper tray becomes empty, temperature drops below freezing State: behavioral condition that persists in time –often corresponds to verbs with suffix of “-ing” e.g., Boiling, Waiting, Dialing –in OO terms: an abstraction of values of attributes and configuration of objects Transition: instantaneous change in state –triggered by an event

K. Stirewalt CSE 335: Software Design State diagrams Graphical state-modeling notation: –States: labeled roundtangles –Transitions: directed arcs, labeled by triggering event, guard condition, and/or effects Example: ST States

K. Stirewalt CSE 335: Software Design State diagrams Graphical state-modeling notation: –States: labeled roundtangles –Transitions: directed arcs, labeled by triggering event, guard condition, and/or effects Example: ST States Transition

K. Stirewalt CSE 335: Software Design State diagrams Graphical state-modeling notation: –States: labeled roundtangles –Transitions: directed arcs, labeled by triggering event, guard condition, and/or effects Example: ST event(attribs) [condition] / effect States Event Transition

K. Stirewalt CSE 335: Software Design Enabling and firing of transitions Transition is: –enabled when source state is active and guard condition satisfied –fires when enabled and the triggering event occurs Example below: –enabled when current state is Editing and the form is complete –fires when the user presses the “OK” button EditingSubmitted pressOK [form complete]

K. Stirewalt CSE 335: Software Design Enabling and firing of transitions Transition is: –enabled when source state is active and guard condition satisfied –fires when enabled and the triggering event occurs Example below: –enabled when current state is Editing and the form is complete –fires when the user presses the “OK” button EditingSubmitted pressOK [form complete] Question: What happens if user presses “OK” when transition not enabled?

K. Stirewalt CSE 335: Software Design Example White’s turn Black’s turn Black wins White wins Draw white moves black moves checkmate stalemate Chess game

K. Stirewalt CSE 335: Software Design Example White’s turn Black’s turn Black wins White wins Draw white moves black moves checkmate stalemate Chess game final states start state

K. Stirewalt CSE 335: Software Design Kinds of events Signal event: –occurrence of a signal an explicit one-way transmission of information may be parameterized –E.g., stringEntered(“Foo”) –Sending of a signal by one object is a distinct event from its reception by another Change event: –Event caused by satisfaction of a Boolean expression –Intent: Expression continually tested; when changes from false to true, the event happens –Notation: when(bool-expr) Time event: –Example: after(10 seconds)

K. Stirewalt CSE 335: Software Design Activities Often useful to specify an activity that is performed within a given state –E.g., while in PaperJam state, the warning light should be flashing –E.g., on entry into the Opening state, the motor should be switched on –E.g., upon exit of the Opening state, the motor should be switched off

K. Stirewalt CSE 335: Software Design Examples PaperJam do/ flash warning light Opening entry / motor up exit / motor off

K. Stirewalt CSE 335: Software Design Problems with FSMs Difficult to read with lots of states and transitions Two sources: –Multiple transitions with same triggering event, guard condition, and response but different source and/or target states –State explosion due to concurrency and/or orthogonality Ameliorated somewhat by modularity features: –State generalization –Parallel composition

K. Stirewalt CSE 335: Software Design Example: Automatic transmission NeutralReverse FirstSecondThird upshift downshift upshift downshift pushN pushR pushF pushN Transmission

K. Stirewalt CSE 335: Software Design Problem: Multiple similar transitions NeutralReverse FirstSecondThird upshift downshift upshift downshift pushN pushR pushF pushN Transmission

K. Stirewalt CSE 335: Software Design Solution: State generalization NeutralReverse FirstSecondThird upshift downshift upshift downshift pushN pushR pushF pushN Forward Transmission

K. Stirewalt CSE 335: Software Design State generalization Introduces an abstract “super state”: –decomposes into multiple substates –when super state is active, exactly one of its substates is active Outbound transition incident on superstate abbreviates set of transitions, one from each substate Inbound transition incident on superstate enters substate that is distinguished as the start state

K. Stirewalt CSE 335: Software Design Example: Lifecycle of a thread Ready Running Terminated Blocked dispatch yield Runnable resume suspend stop Created stop start end Thread stop

K. Stirewalt CSE 335: Software Design Problem: Composite behaviors Consider an automobile with multiple options: –Automatic transmission –Temperature control (heating/air) –Rear-window defroster –Stereo system Suppose we wish to construct a state diagram for the autmobile: –Assume car starts with transmission in neutral and temp control, rear defroster, and stereo are all off –What are the possible next states?

K. Stirewalt CSE 335: Software Design Example: Automobile states Started HeatOn_Neutral_DefOff_RadOff AirOn_Neutral_DefOff_RadOff TCOff_Reverse_DefOff_RadOff TCOff_First_DefOff_RadOff... pushHeat pushAir pushR pushF

K. Stirewalt CSE 335: Software Design State explosion problem Number of states in a composite diagram is product of the number of states in component diagrams Major impediment to understanding: –Impossible to visualize in any meaningful way –Requires the use of analysis tools to verify properties Managing state explosion: –Concurrent state diagrams –Highly effective when diagram can be separated into truly orthogonal components

K. Stirewalt CSE 335: Software Design Example TempOff Automobile Cooling Heating pushHeat pushAir TempOn pushHeat pushAir pushTCOff Temperature control Rear defroster RDOffRDOn pushRD RadOffRadOn pushRad Radio control

K. Stirewalt CSE 335: Software Design Semantics of parallel composition Multiple interpretations: –Concurrent regions execute independently What happens if transitions in different regions are triggered by same event? Do both execute simultaneously? Does one “consume” the event to the exclusion of the other? –Concurrent regions communicate with one another, synchronizing on common events Regions can only proceed when all are ready to proceed Regions transfer data values during a concurrent transition –Do we distinguish internal and external events?