UML State Machine Diagrams and Modeling

Slides:



Advertisements
Similar presentations
© 2005 by Prentice Hall Appendix 3 Object-Oriented Analysis and Design Modern Systems Analysis and Design Fourth Edition Jeffrey A. Hoffer Joey F. George.
Advertisements

Chapter 7 System Models.
State Diagram 1. State diagram: Shows the behavior of one object. They describe all of the possible states that a particular object can get into and how.
Chapter 29 State Machine Diagrams Sate Machine Diagrams Represent state of an object Behavior as reaction to events.
State Charts Mehran Najafi. Reactive Systems A reactive, event-driven, object is one whose behavior is best characterized by its response to events dispatched.
CSSE 374: Persistent Frameworks with GoF Design Patterns & Deployment Diagrams Steve Chenoweth Office: Moench Room F220 Phone: (812)
Interaction Diagram Notation From Chapter 15 of Craig Larman, Applying UML and Patterns John Dalesandro.
© 2006 ITT Educational Services Inc. SE350 System Analysis for Software Engineers: Unit 9 Slide 1 Appendix 3 Object-Oriented Analysis and Design.
System Modelling System modelling helps the analyst to understand the functionality of the system and models are used to communicate with customers. Different.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 8 Slide 1 System models.
CS 425/625 Software Engineering System Models
©Ian Sommerville 2000Software Engineering, 6/e, Chapter 71 System models l Abstract descriptions of systems whose requirements are being analysed.
1 CS 691z/791z Topics in Software Engineering Chapter 20: Advanced Statechart Modeling [Arlow and Neustadt, 2002] March 8, 2007.
1 CS/CPE 426 Senior Projects Chapter 21: State Machines Chapter 22:Advanced State Machines [Arlow and Neustadt 2005] March 24, 2009.
SE-565 Software System Requirements More UML Diagrams.
Unified Modeling Language
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 1 System models l Abstract descriptions of systems whose requirements are being.
Chapter 5 – System Modeling
Chapter 13 Starting Design: Logical Architecture and UML Package Diagrams.
Chapter 10 State Machine Diagrams
CS 310 Ch8: System models Abstract descriptions of systems being analyzed to help the analyst understand the system functionality communicate with customers.
Software Engineering 1 Object-oriented Analysis and Design Chap 29 UML State Machine Diagrams and Modeling.
NJIT Modeling Behavior in State Chart Diagrams Chapter 29 Rafael Mello.
1 On to Object Design Chapter 14 Applying UML and Patterns.
©Ian Sommerville 1995/2000 (Modified by Spiros Mancoridis 1999) Software Engineering, 6th edition. Chapter 7 Slide 1 System models l Abstract descriptions.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 8 Slide 1 Object-oriented and Structured System Models.
11 Software Engineering Dr. K. T. Tsang Lecture 9 Advance State Modeling
Slide 1 System models. Slide 2 Objectives l To explain why the context of a system should be modelled as part of the RE process l To describe behavioural.
Modified by Juan M. Gomez Software Engineering, 6th edition. Chapter 7 Slide 1 Chapter 7 System Models.
Software Engineering, 8th edition Chapter 8 1 Courtesy: ©Ian Somerville 2006 April 06 th, 2009 Lecture # 13 System models.
Sommerville 2004,Mejia-Alvarez 2009Software Engineering, 7th edition. Chapter 8 Slide 1 System models.
Session 22 Modeling the Extended Features of the Statechart Written by Thomas A. Pender Published by Wiley Publishing, Inc. October 27, 2011 Presented.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 1 Chapter 7 System Models.
Chapter 38 Persistence Framework with Patterns 1CS6359 Fall 2011 John Cole.
7 Systems Analysis and Design in a Changing World, Fifth Edition.
What to remember from Chap 13 (Logical architecture)
OO Methodology Elaboration Iteration 3 – Part 2 Refining Models.
Drawing System Sequence Diagrams
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.
Chapter 29 State Machine Diagrams 1CS6359 Fall 2011 John Cole.
UML Discussion on State Machines Perfectly static system is intensely uninteresting Because nothing ever happens.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 8 Slide 1 System models.
States.
PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 3rd Edition Copyright © 2009 John Wiley & Sons, Inc. All rights.
INFO 620Lecture #71 Information Systems Analysis and Design Design Class Diagrams and others INFO 620 Glenn Booker.
Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall Object-Oriented Systems Analysis and Design Using UML Systems Analysis and Design,
Elaboration Iteration 3 – Part 3 - Persistence Framework -
UML (Unified Modeling Language)
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.
McGraw-Hill/Irwin© 2008 The McGraw-Hill Companies, All Rights Reserved Chapter 17 Object-Oriented Design and Modeling Using the UML.
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.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 8 Slide 1 System models.
Object-oriented and Structured System Models
State Machine Diagram.
Object-Oriented Systems Analysis and Design Using UML
Software Engineering Chapter 5 (Part 3) System Modeling Dr.Doaa Sami.
Model-View-Controller
Princess Nourah bint Abdulrahman University
States.
CS/CPE 426 Senior Projects
Starting Design: Logical Architecture and UML Package Diagrams
CS/CPE 426 Senior Projects
States.
State Machine Diagrams
CS 791Z State Machines & Advanced State Machines
Appendix 3 Object-Oriented Analysis and Design
Modeling Behavior in Statechart Diagrams
UML State Diagrams (Ch. 29)
Presentation transcript:

UML State Machine Diagrams and Modeling Chapter 29 UML State Machine Diagrams and Modeling

State Machine Diagram Illustrates the interesting events and states of an object and the behavior of an object in reaction to an event. Event: significant or noteworthy occurrence. E.g., telephone receiver taken off hook. State: the condition of an object at a moment in time (between events). Transition: a relationship between two states; when an event occurs, the object moves from the current state to a related state.

UML State Machine Diagram States shown as rounded rectangles. Transitions shown as arrows. Events shown as labels on transition arrows. Initial pseudo-state automatically transitions to a particular state on object instantiation. Events with no corresponding transitions are ignored.

Fig. 29.1 State machine diagram for a telephone

Transition Actions and Guards A transition can cause an action to fire. In software implementation, a method of the class of the state machine is invoked. A transition may have a conditional guard. The transition occurs only if the test passes.

Fig. 29.2 Transition action and guard notation

A state may be represented as nested substates. Nested States A state may be represented as nested substates. In UML, substates are shown by nesting them in a superstate box. A substate inherits the transitions of its superstate. Allows succinct state machine diagrams.

Fig. 29.3 Nested states

State-Independent vs. State-Dependent State-independent (modeless) — type of object that always responds the same way to an event. State-dependent (modal) — type of object that reacts differently to events depending on its state or mode. Use state machine diagrams for modeling state-dependent objects with complex behavior, or to model legal sequences of operations.

Modeling State-dependent Objects Complex reactive objects Physical devices controlled by software E.g., phone, microwave oven, thermostat Transactions and related business objects Protocols and legal sequences Communication protocols (e.g., TCP) UI page/window flow or navigation UI flow controllers or sessions Use case system operations

Fig. 29.4 Web page navigation modeling

Fig. 29.5 Legal sequence of use case operations

GoF State Pattern Problem: Solution: An object’s behavior is dependent on its state, and its methods contain case logic reflecting conditional state-dependent actions. Solution: Create a state class for each state, implementing a common interface. Delegate state-dependent operations from the context object to its current state object. Ensure context object always points to a state object reflecting its current state.

Example: Transactional States A transactional support system typically keeps track of the state of each persistent object. Modifying a persistent object does not cause an immediate database update — an explicit commit operation must be performed. A delete or save causes change of state, not an immediate database delete or save. A commit operation updates the database if an object was modified (“dirty”), but does nothing if the object is “clean”.

Fig. 38.12 Statechart for PersistentObject

Fig. 38.13 Persistent Objects Assume all persistent object classes extend a PersistentObject class that provides common technical services for persistence.

Case-logic Structure Using case logic, commit and rollback methods perform different actions, but have a similar logic structure. public void commit() { switch ( state ) case OLD_DIRTY: // . . . break; case OLD_CLEAN: . . .

State Transition Model using State Pattern Implementing transactional states: Create static singleton objects for each state that are specializations of PObjectState. The commit method is implemented differently in each state object. PersistentObject is the context object. Keeps a reference to a state object representing the current state. Methods in the state objects call setState() to cause a transistion to the next state. No case logic is needed.