CSC 422 Kutztown University Dr. Spiegel

Slides:



Advertisements
Similar presentations
Decision Structures - If / Else If / Else. Decisions Often we need to make decisions based on information that we receive. Often we need to make decisions.
Advertisements

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.
NCKU EE RTES LAB.1 Unified Modeling Language - Events and State Machines.
State Charts Mehran Najafi. Reactive Systems A reactive, event-driven, object is one whose behavior is best characterized by its response to events dispatched.
Karolina Muszyńska Based on: S. Wrycza, B. Marcinkowski, K. Wyrzykowski „Język UML 2.0 w modelowaniu SI”
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.
Vered Gafni, The Design Language of Statecharts.
Activity Diagrams in UML. Definition Activity diagrams represent the dynamics of the system. They are flow charts that are used to show the workflow of.
ESE Einführung in Software Engineering 7. Modeling Behaviour Prof. O. Nierstrasz.
Introduction to Software Engineering 7. Modeling Behaviour.
CS189A/172 - Winter 2008 Lectures 8 and 9: UML. UML (Unified Modeling Language) Combines several visual specification techniques –use case diagrams, component.
Ch5: Software Specification. 1 Dynamic modeling using UML  Static models:  Dynamic models:
1 CS 691z/791z Topics in Software Engineering Chapter 13: Activity Diagrams & Chapter 19: Basic Statecharts [Arlow and Neustadt, 2002] March 8, 2007.
State Machine Diagrams (State Chart in UML 1) Specifying Control (ref: Chapter 11 Bennett, Mc Robb and Farmer)
THE OBJECT-ORIENTED DESIGN WORKFLOW Statechart Diagrams.
State Change Modelling. Aim: To introduce the concept and techniques for describing the changes in state that may occur to an object in its lifetime.
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.
CS451 Introduction to Software Engineering Behavioral Modeling.
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
1 Object-Oriented Modeling Using UML (2) CS 3331 Fall 2009.
State diagrams Interaction diagrams –Sequence diagrams –Collaboration diagrams Object orientation Part 4: Dynamic Modeling.
1 Software Engineering Dr. K. T. Tsang Lecture 8 State modeling
Guide to State Transition Diagram. 2 Contents  What is state transition diagram?  When is state transition diagram used?  What are state transition.
Behavioral diagrams Lecture p4 T120B pavasario sem.
Object-Oriented Modeling Using UML CS 3331 Section 2.3 of Jia 2003.
Session 21 Applying the Basic Statechart to the Case Study Written by Thomas A. Pender Published by Wiley Publishing, Inc. October 27, 2011 Presented by.
Session 22 Modeling the Extended Features of the Statechart Written by Thomas A. Pender Published by Wiley Publishing, Inc. October 27, 2011 Presented.
CSIS3600 System Analysis and Design Statechart Diagrams.
University of Toronto at Scarborough © Kersti Wain-Bantin CSCC40 state charts 1 object states an object state is a condition or situation during the life.
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.
UML Discussion on State Machines Perfectly static system is intensely uninteresting Because nothing ever happens.
Object Oriented Analysis & Design & UML (Unified Modeling Language)1 Part VI: Design Continuous Activity Diagams State Diagrams.
CS212: Object Oriented Analysis and Design Lecture 34: UML Activity and Collaboration diagram.
CSCI1600: Embedded and Real Time Software Lecture 7: Modeling II: Discrete Systems Steven Reiss, Fall 2015.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 UML State Diagrams.
States.
CS3773 Software Engineering Lecture 06 UML State Machines.
Statechart Diagrams. Creating a Statechart Diagram A Statechart diagram shows the life cycle of a single object, from the time that it is created until.
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.
Modeling Object Lifecycles and State-Dependent Behavior ©SoftMoore ConsultingSlide 1.
State Machine Diagram Chapter 5 Introduction Pages
The Dynamic Analysis Model StateCharts Prof. Hany H. Ammar, CSEE, WVU, and Dept. of Computer Science, Faculty of Computers and Information, Cairo University.
Test Generation from UML Specifications Michael A. Gray American University Washington, DC.
1 Object Oriented Analysis System modeling = Functional modeling + Object modeling + Dynamic modeling Functional modeling = Use cases Object modeling =class.
UML Review: State Machines. Sept. 17, 2003Lecture 5: CS660 Fall Overview States Transitions Activities Modeling object lifeline Creating well-structured.
Activity Diagram.
State transition modeling
State Machine Model.
State Machine Diagram.
State Machine Diagrams
Marlon Dumas Institute of Computer Science
Visit for more Learning Resources
State Machine Diagrams
UML State Diagrams.
Finite State Machines and Statecharts
UML State machine diagram
States.
Object Oriented System Design
Finite State Machines and Statecharts
Chapter 5 state Modeling
Marlon Dumas Institute of Computer Science
States.
UML Diagrams: StateCharts The Dynamic Analysis Model
UML State Diagrams.
Presentation transcript:

CSC 422 Kutztown University Dr. Spiegel State Diagrams CSC 422 Kutztown University Dr. Spiegel

State or Statechart Diagrams Finite state machine for 1 class show states objects in class can be in show responses to external stimuli States have associated code can have internal finite state machines Transitions show when state changes

State Diagrams State diagrams are used to show possible states a single object can get into shows states of an object How object changes state in response to events shows transitions between states UML state diagrams are a variation of Statecharts Statecharts are hierarchical state machines Statecharts have formal semantics

State Diagrams: States States are represented as rounded boxes which contain: the state name and the following optional fields entry and exit actions: entry and exit actions are executed whenever the state is entered or exited, respectively internal transitions: internal transitions do not activate the entry and exit actions (different than self-transitions which activate the entry and exit actions). activities: Typically, once the system enters a state it sits idle until an event triggers a transition. Activities help you to model situations where while in a state, the object does some work that will continue until it is interrupted by an event deferred events: If an event does not trigger a transition in a state, it is lost. In situations where you want to save an event until it triggers a transition, use deferred events

State Diagrams: States Tracking entry action entry / setMode(on Track) exit / setMode(off Track) newTarget / tracker.Acquire() do / followTarget selfTest / defer exit action internal transition activity deferred event Note that, “entry”, “exit”, “do”, and “defer” are keywords

State Diagrams: Transitions source state and target state: shown by the arrow representing the transition trigger event: the event that makes the transition fire guard condition: a boolean expression that is evaluated when the trigger event occurs, the transition can fire only if the guard condition evaluates to true action: an executable atomic computation that can directly act on the object that owns the state machine or indirectly on other objects that are visible to the object initial and final states: shown as filled circle and a filled circle surrounded by an unfilled circle, respectively source state target state trigger-event[guard-condition]/action

State Diagrams shows the initial (default) state / getFirstItem getNextItem [not all items checked] Checking do / checkItem cancelled shows the final state

State Diagram Example: Order Object Initial State /getFirstItem [stillMore] / getNextItem [AllItemsChecked && AllItemsAvailable ] Checking do: checkItem Dispatching do: delivery Waiting [AllItemsCheck && SomeNotAvailable ] Delivered ItemReceived [AllItemsAvailable] Delivered ItemReceived [SomeNotAvailable]

Example with Cancelled State Initial State /getFirstItem [stillMore] / getNextItem [AllItemsChecked && AllItemsAvailable ] Checking do: checkItem Dispatching do: delivery Waiting ItemReceived [AllItemsAvailable] [AllItemsCheck && SomeNotAvailable ] Delivered Cancel Cancel Delivered ItemReceived [SomeNotAvailable] Cancel Cancelled

Example: Add Super State /getFirstItem Active [stillMore] / getNextItem [AllItemsChecked && AllItemsAvailable ] Dispatching do: delivery Checking do: checkItem [AllItemsCheck && SomeNotAvailable ] ItemReceived [AllItemsAvailable] Waiting Delivered ItemReceived [SomeNotAvailable] Cancel Delivered Cancelled

Concurrent State Diagrams Order object of example also has states associated with the payment authorization Could Authorize between Dispatching and Delivery. Not nice. Concurrency better system in 2 states while in concurrent mode [Payment not OK] Rejected Authorizing do: checkPmt [Payment OK] Authorized deliver Delivered

Concurrency Example Order Object Waiting Cancelled cancel Checking Dispatching delivered Delivered Authorizing Authorized end Rejected

Concurrency Example (cont) Inside the concurrency block the Order object is in 2 states; when it leaves it is only in one Order object starts out in both the Checking and Authorizing states If the Authorizing:checkPmt step finishes first if successful, state is Authorized and Checking else exit concurrent phase to Rejected else could be Authorizing/Waiting or Authorizing/Dispatching and so on.