Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 29 State Machine Diagrams 1CS6359 Fall 2011 John Cole.

Similar presentations


Presentation on theme: "Chapter 29 State Machine Diagrams 1CS6359 Fall 2011 John Cole."— Presentation transcript:

1 Chapter 29 State Machine Diagrams 1CS6359 Fall 2011 John Cole

2 State Machine Diagrams They show a dynamic view, the interactions between states of an object and reaction to events. CS6359 Fall 2012 John Cole2

3 Event A significant or noteworthy occurrence – A telephone is taken off-hook – A key is pressed on a keyboard – A door is opened – A quarter is put into a vending machine CS6359 Fall 2011 John Cole3

4 Transition Relationship between two states that indicates that when an event occurs, the object moves from the prior state to the subsequent state. When off-hook occurs, transition from Idle to Active state CS6359 Fall 2011 John Cole4

5 Applying the Diagrams If an object always responds the same way to an event, it is state-independent or modeless. State-dependent objects react differently to messages depending upon their state. A telephone is very state-dependent. Its response to pushing buttons depends whether it is on-hook or off-hook and whether there is an ongoing call or not. CS6359 Fall 2011 John Cole5

6 When to Use Consider state machines and diagrams for complex, state-dependent objects, not for state-independent objects. Business information systems seldom have much state-dependent behavior (although the UI may have some) Process control, device control, and telecom have many state-dependent objects CS6359 Fall 2011 John Cole6

7 Modeling State-Dependent Objects State machines applied in 2 ways: – Model the behavior of a complex reactive object in response to events – Model legal sequences of operations such as protocol or language specifications. A formal grammar is a kind of state machine CS6359 Fall 2011 John Cole7

8 Complex Reactive Objects Physical devices Transactions between related business objects. How does sale, order or payment react to an event? Role mutators are objects that change roles based upon events. Person changes from civilian to veteran. City changes from destination to origin. CS6359 Fall 2011 John Cole8

9 Protocols TCP can be understood with a state machine diagram UI page/window flow or navigation UI flow controllers or sessions Use case system operations Individual UI event handling CS6359 Fall 2011 John Cole9

10 Transition Actions and Guards Transition can cause an action. This may be invocation of a method. Transition may also have a test and it occurs only if the test passes. CS6359 Fall 2011 John Cole10

11 Nested States States can have substates which inherit the transitions of the superstate. CS6359 Fall 2011 John Cole11


Download ppt "Chapter 29 State Machine Diagrams 1CS6359 Fall 2011 John Cole."

Similar presentations


Ads by Google