Business Informatics Group Institute of Software Technology and Interactive Systems Vienna University of Technology Favoritenstraße 9-11/188-3, 1040 Vienna,

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

Nested state diagrams:Problems with flat state diagram
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.
ESE Einführung in Software Engineering 7. Modeling Behaviour Prof. O. Nierstrasz.
® IBM Software Group © 2006 IBM Corporation Rational Software France Object-Oriented Analysis and Design with UML2 and Rational Software Modeler 04. Other.
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.
Copyright W. Howden1 Lecture 12: State Chart Models.
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.
SE-565 Software System Requirements More UML Diagrams.
An Introduction to Rational Rose Real-Time
Department of Computer Science 1 CSS 496 Business Process Re-engineering for BS(CS)
Department of Computer Science 1 CSS 496 Business Process Re-engineering for BS(CS)
State and Sequence Diagrams Modelling dynamic information So far we have seen: Use Case Diagrams – requirements capture, interface.
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. Today’s Session Sequence Diagrams State Machines 2.
UML Notations in CommonKADS Activity diagrams State diagrams Class diagrams Use-case diagrams.
1 Object-Oriented Modeling Using UML (2) CS 3331 Fall 2009.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 21. Review ANALYSIS PHASE (OBJECT ORIENTED DESIGN) Functional Modeling – Use case Diagram Description.
Object-Oriented Modeling
Business Informatics Group Institute of Software Technology and Interactive Systems Vienna University of Technology Favoritenstraße 9-11/188-3, 1040 Vienna,
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.
Business Informatics Group Institute of Software Technology and Interactive Systems Vienna University of Technology Favoritenstraße 9-11/188-3, 1040 Vienna,
Session 22 Modeling the Extended Features of the Statechart Written by Thomas A. Pender Published by Wiley Publishing, Inc. October 27, 2011 Presented.
Activity diagrams. Introduction ● Activity diagrams are a behavioural model that represent the dynamics of the system. ● An activity diagram is essentially.
7 Systems Analysis and Design in a Changing World, Fifth Edition.
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.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 UML Activity Diagrams.
CSCI-383 Object-Oriented Programming & Design Lecture 12.
Chapter 11 Activity Diagrams. 2 “Activity diagrams are a technique to describe procedural logic, business processes, and work flows” - M. Fowler An activity.
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.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 UML State Diagrams.
Systems Analysis and Design in a Changing World, Fourth Edition
States.
CS3773 Software Engineering Lecture 06 UML State Machines.
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.
 Activity diagram is basically a flow chart to represent the flow from one activity to another activity.
1 7 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Chapter 7 The Object-Oriented Approach to Requirements.
State Modeling. Introduction A state model describes the sequences of operations that occur in response to external stimuli. As opposed to what the operations.
® IBM Software Group © 2009 IBM Corporation Module 11: Creating State Machine Diagrams Essentials of Modeling with IBM Rational Software Architect V7.5.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Advanced UML State Diagrams.
State Machine Diagram.
Building System Models for RE
Activity Diagram.
Sequence Diagram.
State Machine Diagrams
UML Activity Diagrams & State Charts
States.
Object Oriented System Design
CS/CPE 426 Senior Projects
BPMN - Business Process Modeling Notations
Chapter 5 state Modeling
CS/CPE 426 Senior Projects
States.
CS 791Z State Machines & Advanced State Machines
Behavioral Diagrams P. P. Mahale
Presentation transcript:

Business Informatics Group Institute of Software Technology and Interactive Systems Vienna University of Technology Favoritenstraße 9-11/188-3, 1040 Vienna, Austria phone: +43 (1) (secretary), fax: +43 (1) Object-Oriented Modeling State Machine Diagram Slides accompanying Version 1.0

© BIG / TU Wien Literature Classroom: An Introduction to Object-Oriented Modeling Martina Seidl, Marion Scholz, Christian Huemer and Gerti Kappel Springer Publishing, 2015 ISBN  The lecture is based on the following book:  Use Case Diagram  Structure Modeling  State Machine Diagram  Sequence Diagram  Activity Diagram 2

© BIG / TU Wien Content  Introduction  States  Transitions  Types of events  Types of states  Entry and exit points 3

© BIG / TU Wien Introduction  Every object takes a finite number of different states during its life  State machine diagram is used as follows:  To model the possible states of a system or object  To show how state transitions occur as a consequence of events  To show what behavior the system or object exhibits in each state  Example: high-level description of the behavior of a lecture hall TransitionState 4

© BIG / TU Wien Example: Lecture Hall with Details class LectureHall { private boolean free; public void occupy() { free=false; } public void release() { free=true; } 5

© BIG / TU Wien Example: Digital Clock 6

© BIG / TU Wien State  States = nodes of the state machine  When a state is active  The object is in that state  All internal activities specified in this state can be executed  An activity can consist of multiple actions  entry / Activity(...)  Executed when the object enters the state  exit / Activity(...)  Executed when the object exits the state  do / Activity(...)  Executed while the object remains in this state 7

© BIG / TU Wien Transition  Change from one state to another Source stateTarget stateTransition EventGuardSequence of actions (effect) 8

Transition – Syntax  Event (trigger)  Exogenous stimulus  Can trigger a state transition  Guard (condition)  Boolean expression  If the event occurs, the guard is checked  If the guard is true  All activities in the current state are terminated  Any relevant exit activity is executed  The transition takes place  If the guard is false  No state transition takes place, the event is discarded  Activity (effect)  Sequence of actions executed during the state transition 9

© BIG / TU Wien Transition – Types (1/2) Internal transitionExternal transition  If event1 occurs  Object remains in state1  Activity3 is executed  If event1 occurs  Object leaves state1 and Activity2 is executed  Activity3 is executed  Object enters state1 and Activity1 is executed 10

© BIG / TU Wien Transition – Types (2/2)  When do the following transitions take place? If e1 occurs, A1 is aborted and the object changes to S2 If e1 occurs and g1 evaluates to true, A1 is aborted and the object changes to S2 As soon as the execution of A1 is finished, a completion event is generated that initiates the transition to S2 As soon as the execution of A1 is finished, a completion event is generated; if g1 evaluates to true, the transition takes place; If not, this transition can never happen 11

© BIG / TU Wien Transition – Sequence of Activity Executions  Assume S1 is active … what is the value of x after e occurred? S1 becomes active, x is set to the value 4 S1 is left, x is set to 5 e occurs, the guard is checked and evaluates to true The transition takes place, x is set to 10 S2 is entered, x is set to 11 12

© BIG / TU Wien Example: Registration Status of an Exam 13

© BIG / TU Wien Event – Types (1/2)  Signal event Receipt of a signal  E.g., rightmousedown, sendSMS(message)  Call event Operation call  E.g., occupy(user,lectureHall), register(exam)  Time event Time-based state transition  Relative: based on the time of the occurrence of the event  E.g., after(5 seconds)  Absolute  E.g., when(time==16:00), when(date== ) 14

© BIG / TU Wien Event – Types (2/2)  Any receive event Occurs when any event occurs that does not trigger another transition from the active state  Keyword all  Completion event Generated automatically when everything to be done in the current state is completed  Change event Permanently checking whether a condition becomes true  E.g., when(x > y), after(90min) 15

© BIG / TU Wien Change Event vs. Guard Checked permanently Only checked when event occurs Question: What if the lecture is shorter than 90min? 16

© BIG / TU Wien Initial State  “Start” of a state machine diagram  Pseudostate  Transient, i.e., system cannot remain in that state  Rather a control structure than a real state  No incoming edges  If >1 outgoing edges  Guards must be mutually exclusive and cover all possible cases to ensure that exactly one target state is reached  If initial state becomes active, the object immediately switches to the next state  No events allowed on the outgoing edges (exception: new()) 17

© BIG / TU Wien Final State and Terminate Node Final State  Real state  Marks the end of the sequence of states  Object can remain in a final state forever Terminate Node  Pseudostate  Terminates the state machine  The modeled object ceases to exist (= is deleted) 18

© BIG / TU Wien Decision Node  Pseudostate  Used to model alternative transitions equivalent? = ≠ 19

© BIG / TU Wien Example: Decision Node 20

© BIG / TU Wien Parallelization and Synchronization Node Parallelization node  Pseudostate  Splits the control flow into multiple concurrent flows  1 incoming edge  >1 outgoing edges Synchronization node  Pseudostate  Merges multiple concurrent flows  >1 incoming edges  1 outgoing edge 21

© BIG / TU Wien Composite State  Synonyms: complex state, nested state  Contains other states – “substates“  Only one of its substates is active at any point in time  Arbitrary nesting depth of substates Composite state Substates 22

© BIG / TU Wien Entering a Composite State (1/2)  Transition to the boundary  Initial node of composite state is activated EventStateExecuted Activities „Beginning“S3 e2S1/S1.1a0-a2-a3-a4 23

© BIG / TU Wien Entering a Composite State (2/2)  Transition to a substate  Substate is activated EventStateExecuted Activities „Beginning“S3 e1S1/S1.2a0-a1-a3-a7 2324

© BIG / TU Wien Exiting from a Composite State (1/3)  Transition from a substate EventStateExecuted Activities „Beginning“S1/S1.1a3-a4 e3S2a6-a5-a2-a1 25

© BIG / TU Wien EventStateExecuted Activities „Beginning“S1/S1.1a3-a4 e5S2a6-a5-a3-a1 Exiting from a Composite State (2/3)  Transition from the composite state No matter which substate of S1 is active, as soon as e5 occurs, the system changes to S2 26

© BIG / TU Wien EventStateExecuted Activities „Beginning“S1/S1.1a3-a4 e4S1/S1.2a6-a7 e4S2a8-a5-a1 Exiting from a Composite State (3/3)  Completion transition from the composite state 27

© BIG / TU Wien Orthogonal State  Composite state is divided into two or more regions separated by a dashed line  One state of each region is always active at any point in time, i.e., concurrent substates  Entry: transition to the boundary of the orthogonal state activates the initial states of all regions  Exit: final state must be reached in all regions to trigger completion event Using parallelization and synchronization node to enter different substates 28

© BIG / TU Wien Submachine State (SMS)  To reuse parts of state machine diagrams in other state machine diagrams  Notation: state:submachineState  As soon as the submachine state is activated, the behavior of the submachine is executed  Corresponds to calling a subroutine in programming languages 29 Refinement symbol (optional)

© BIG / TU Wien History State  Remembers which substate of a composite state was the last active one  Activates the “old” substate and all entry activities are conducted sequentially from the outside to the inside of the composite state  Exactly one outgoing edge of the history state points to a substate which is used if  the composite state was never active before  the composite state was exited via the final state  Shallow history state restores the state that is on the same level of the composite state  Deep history state restores the last active substate over the entire nesting depth 30

© BIG / TU Wien Example: History State (1/4) EventState „Beginning“S5 e1S4/S1/S1.1 e2S1.2 e10S5 e9(H → ) S1/S1.1 31

© BIG / TU Wien Example: History State (2/4) EventState „Beginning“S5 e1S4/S1/S1.1 e2S1.2 e10S5 e8(H* → ) S1.2 32

© BIG / TU Wien Example: History State (3/4) EventState „Beginning“S5 e9(H → ) S1/S1.1 33

© BIG / TU Wien Example: History State (4/4) EventState „Beginning“S5 e8(H* → ) S3/S3.1 34

© BIG / TU Wien Entry and Exit Points  Encapsulation mechanism  A composite state shall be entered or exited via a state other than the initial and final states  The external transition must/need not know the structure of the composite state External view 35

© BIG / TU Wien Example: Entry and Exit Points 36

© BIG / TU Wien Notation Elements (1/2) NameNotationDescription State Description of a specific “time span” in which an object finds itself during its “life cycle”. Within a state, activities can be executed by the object. Transition State transition e from a source state S to a target state T Initial state Start of a state machine diagram Final state End of a state machine diagram Terminate node Termination of an object’s state machine diagram 37

© BIG / TU Wien Notation Elements (2/2) Name SyntaxBeschreibung Decision node Node from which multiple alternative transitions can origin Parallelization node Splitting of a transition into multiple parallel transitions Synchronization node Merging of multiple parallel transitions into one transition Shallow / deep history state “Return address” to a substate or a nested substate of a composite state 38