State Machines and Object Life Cycles G. Falquet, L. Nerima.

Slides:



Advertisements
Similar presentations
1 MODULE name (parameters) “Ontology” “Program” “Properties” The NuSMV language A module can contain modules Top level: parameters less module Lower level.
Advertisements

Process Patterns in BizAGI. Slide 2 Overview Types of events Types of gateways Design patterns list.
© 2006 ITT Educational Services Inc. SE350 System Analysis for Software Engineers: Unit 9 Slide 1 Appendix 3 Object-Oriented Analysis and Design.
Software Requirements Engineering
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.
7M701 1 Activity Diagram. 7M701 2 Example 7M701 3 Activity Diagram: what is it? Describes activities and flows of data or decisions between activities.
Introduction to BizAgi. Slide 2 User Interface (Summary) The user interface for BizAgi resembles Office It uses a similar ribbon The Palette contains.
7M822 UML Activity Diagrams 6 October 2008.
Use Cases G. Falquet, L. Nerima. ISIISI June G. Falquet, L. NerimaUse Cases 2 References Jacobson, M. Christerson, P. Jonsson, G. Overgard “ Object-Oriented.
1 © Wolfgang Pelz UML2 UML Part 3. 2 © Wolfgang Pelz UML2 Chapter Ten State Machine Diagrams.
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.
UML Sequence Diagrams Eileen Kraemer CSE 335 Michigan State University.
Activity Diagrams Derived from several techniques: Event diagrams of Jim Odell SDL state modeling techniques Workflow modeling Petri nets Especially useful.
Systems Analysis and Design in a Changing World, 6th Edition
Advanced Behavioral Modeling
Sequence diagrams G. Falquet, L. Nerima. ISIISI June G. Falquet, L. NerimaSequence Diagrams 2 Objectives vTo show object interactions arranged.
Department of Computer Science 1 CSS 496 Business Process Re-engineering for BS(CS)
CMPT 275 Software Engineering
UML Sequence Diagrams Michael L. Collard, Ph.D. Department of Computer Science Kent State University.
Chapter 10 State Machine Diagrams
Class, Sequence and UML Model.  Has actors and use cases.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 8: Modelling Interactions and Behaviour.
מידול התנהגותי 1. Today’s Session Sequence Diagrams State Machines 2.
1 Object-Oriented Modeling Using UML (2) CS 3331 Fall 2009.
Introduction to Sequence Diagrams
Fall 2010 CS4310 Requirements Engineering UML: Dynamic Modeling Dr. Guoqiang Hu Department of Computer Science UTEP 1.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 21. Review ANALYSIS PHASE (OBJECT ORIENTED DESIGN) Functional Modeling – Use case Diagram Description.
1 CMPT 275 Phase: Design. Janice Regan, Map of design phase DESIGN HIGH LEVEL DESIGN Modularization User Interface Module Interfaces Data Persistance.
1 Sub-Phase Low Level Design (cont). Janice Regan, Map of design phase DESIGN HIGH LEVEL DESIGN Modularization User Interface Module Interfaces.
Systems Analysis and Design in a Changing World, 6th Edition
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.
Intro to Software System Modeling
9-1 © Prentice Hall, 2007 Chapter 9: Analysis Classes Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey.
The Unified Modeling Language Part II Omar Meqdadi SE 2730 Lecture 9 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Slide 1 Project 1 Task 2 T&N3311 PJ1 Information & Communications Technology HD in Telecommunications and Networking Task 2 Briefing The Design of a Computer.
Systems Analysis and Design in a Changing World, 6th Edition 1 Chapter 5 INTRODUCTION TO SYSTEMS ANALYSIS AND DESIGN: AN AGILE, ITERATIVE APPROACH CHAPTER.
1 Graph Coverage (6). Reading Assignment P. Ammann and J. Offutt “Introduction to Software Testing” ◦ Section
Dynamic Models. Outline Dynamic Models Statecharts –States –Transitions –Composite states Interaction Diagrams –Sequence Diagrams The time order of interactions.
Ch5: Software Specification. 1 Petri Nets  Introduced by C. Adams Petri in  Widely used in the modeling and analysis of computer systems.  Basic.
Object Oriented Analysis & Design & UML (Unified Modeling Language)1 Part VI: Design Continuous Activity Diagams State Diagrams.
State Modeling. Events An event is an occurrence at a point in time, such as user depresses left button or.
Dynamic Models Sequence Diagrams Collaboration Diagrams Activity Diagrams.
States.
CS3773 Software Engineering Lecture 06 UML State Machines.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 26. Review UML behavioral Diagrams – Sequence diagram.
Modeling Object Lifecycles and State-Dependent Behavior ©SoftMoore ConsultingSlide 1.
State diagrams Practice 5. Task 1  After the creation of the article “Paper” is only a draft “Draft”. After sending (“send”) this article is considered.
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.
PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th Edition Copyright © 2015 John Wiley & Sons, Inc. All rights.
UML Activity and Sequence Diagrams David Millard
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.
Analysis Classes Unit 5.
Activity Diagrams.
Marlon Dumas Institute of Computer Science
State Machine Diagrams
UML Activity Diagrams & State Charts
States.
Object Oriented System Design
Chapter 10 Object States and The Statechart Diagram
Marlon Dumas Institute of Computer Science
States.
State Machine Diagram.
Appendix 3 Object-Oriented Analysis and Design
Chapter 14. Activity Modeling for Transformational Systems
Object Life Cycles: FSMs
Presentation transcript:

State Machines and Object Life Cycles G. Falquet, L. Nerima

ISIISI June G. Falquet, L. NerimaState Machines 2 Another Modelling Dimension vDynamic view of the objects vHow objects evolve, change their state

ISIISI June G. Falquet, L. NerimaState Machines 3 State Machine vSpecify a sequence of states that an object goes through in response to events vDescribe object life cycles vCentred on one object vContains object states and state transitions vStrong theoretical background: finite state automata, Petri nets, state charts (Harel). Real-time systems.

ISIISI June G. Falquet, L. NerimaState Machines 4 State (of an object) vSituation during the life of an object vDuring this situation the object vsatisfies some condition vor performs some activity vor waits for some event vA state can have substates (finer description)

ISIISI June G. Falquet, L. NerimaState Machines 5 Example: Document in preparation submitted for comments under revision published archived

ISIISI June G. Falquet, L. NerimaState Machines 6 Event v"Noteworthy occurrence that has a location in time and space." vCan trigger a state transition (+ actions). vKinds of event: vcall (operation), vchange (something has changed in the system), vsignal (send an event to another object), vtime (timer, timeout,...)

ISIISI June G. Falquet, L. NerimaState Machines 7 A Simple State Machine for Books available borrowed borrow return transition composite or-state vA transition can be fired only if the object is in the source state and the event occurs.

ISIISI June G. Falquet, L. NerimaState Machines 8 Another State Machine for Books available borrowed borrow return returned check unavailable steal lose discard find consider as lost final state, object deleted

ISIISI June G. Falquet, L. NerimaState Machines 9 Completion transitions idle insert card selecting cancel checking completion transition vTriggered by the completion of the state's activity vNotation: no event name printing

ISIISI June G. Falquet, L. NerimaState Machines 10 Event triggered actions vA transition may execute an action vActions are atomic (assignment, send signal, create object, create link, …) vActions must be fast (≠ complex computation) choose pick date / add to selection push "on"/reset selection push "done" push "reset" / reset selection idle selected

ISIISI June G. Falquet, L. NerimaState Machines 11 Guarded transitions vGuard = additional condition on a transition vTransition fired only if guard is true vOnly one transition fired if several guards are true vGuards are queries (may not change values) waiting going up going down button pressed [selected > current] [selected < current] [selected = current]

ISIISI June G. Falquet, L. NerimaState Machines 12 Guarded completion idle insert card selecting cancel checking printing [operation allowed] [operation refused]

ISIISI June G. Falquet, L. NerimaState Machines 13 Concurrent states vAn object may be in two (or more) states at the same time. vBook: (borrowed + reserved) vBook: (borrowed + not reserved) v=> Large number of combinations vComposite concurrent states

ISIISI June G. Falquet, L. NerimaState Machines 14 Concurrent states (and states) borrowing reserving condition vBeing in state Active means being simultaneously in states condition, borrowing, reserving. Active

ISIISI June G. Falquet, L. NerimaState Machines 15 Composite concurrent states available borrowed borrow return reserved no reservation cancel reservation reserve borrowing reserving condition new good to_be_repaired decide to repair

ISIISI June G. Falquet, L. NerimaState Machines 16 Concurrent active states available borrowed borrow return reserved no reservation reserve cancel reservation initial state

ISIISI June G. Falquet, L. NerimaState Machines 17 Concurrent active states available borrowed borrow return reserved no reservation reserve cancel reservation

ISIISI June G. Falquet, L. NerimaState Machines 18 Concurrent active states available borrowed borrow return reserved no reservation reserve cancel reservation

ISIISI June G. Falquet, L. NerimaState Machines 19 Concurrent active states available borrowed borrow return reserved no reservation reserve cancel reservation

ISIISI June G. Falquet, L. NerimaState Machines 20 Concurrent active states available borrowed borrow return reserved no reservation reserve cancel reservation

ISIISI June G. Falquet, L. NerimaState Machines 21 Concurrent active states available borrowed borrow return reserved no reservation reserve cancel reservation

ISIISI June G. Falquet, L. NerimaState Machines 22 Concurrent active states available borrowed borrow return reserved no reservation reserve cancel reservation

ISIISI June G. Falquet, L. NerimaState Machines 23 Transitions on the same event A B f g C D f f h vWhat happens if A is active and f occurs ? vNon determinism in an or-state

ISIISI June G. Falquet, L. NerimaState Machines 24 In concurrent composite states available borrowed borrow return reserved no reservation reserve cancel reservation borrow

ISIISI June G. Falquet, L. NerimaState Machines 25 In concurrent composite states available borrowed borrow return reserved no reservation reserve cancel reservation borrow

ISIISI June G. Falquet, L. NerimaState Machines 26 Events triggered by other events available borrowed borrow / cancel reservation return reserved no reservation reserve cancel reservation action = signal

ISIISI June G. Falquet, L. NerimaState Machines 27 Events triggered by other events available borrowed borrow / cancel reservation return reserved no reservation reserve cancel reservation

ISIISI June G. Falquet, L. NerimaState Machines 28 Events triggered by other events available borrowed borrow / cancel reservation return reserved no reservation reserve cancel reservation

ISIISI June G. Falquet, L. NerimaState Machines 29 Complex transitions vCreate parallelism vTerminate parallelism (wait) available borrowed borrow return reserved no reservation reserve cancel reservation entered withdrawn fork join

ISIISI June G. Falquet, L. NerimaState Machines 30 Formation rules for complex transitions A vEnter all concurrent subregions vLeave all concurrent subregions

ISIISI June G. Falquet, L. NerimaState Machines 31 Default rules for complex transitions A vActivate the initial state. vLeave the active substate.

ISIISI June G. Falquet, L. NerimaState Machines 32 Structured design of state machines vComposition of and/or states (refinement) v=> no synchronisation problems (deadlocks, etc.) v=> expressiveness slightly limited and A1 A2 A or A11 A12 A13 and

ISIISI June G. Falquet, L. NerimaState Machines 33 Example ordered received entered withdrawn in use

ISIISI June G. Falquet, L. NerimaState Machines 34 Refinement available borrowed borrow return reserved no reservation reserve cancel reservation ordered received entered withdrawn in use

ISIISI June G. Falquet, L. NerimaState Machines 35 Design consideration vState machines form the highest level of abstraction in the "dynamics" dimension vState machines are not flow charts ! vdo not try to express algorithms, methods, computations, etc. with StM vStates must correspond to specific behaviour, conditions, etc. (avoid infinite modelling) vLocal dynamics: state machine of an object vGlobal dynamics: all the state machines (with signals)

ISIISI June G. Falquet, L. NerimaState Machines 36 Implementation vState machines are executable v=> implementation with a state monitor/controller v(transaction monitors, real-time systems, …) vGenerally: transformation into data structures and program code vState ---> attribute value or link. vBook:borrowed == linked to a Loan object. vReport:approved == status = 'a' vTransitions ---> execution of an operation/method.

ISIISI June G. Falquet, L. NerimaState Machines 37 State Machines and Use Cases (Douglass 2000) vCan represent all possible scenarios on a single diagram. vA scenario is a path through the state machine. vUseful to elaborate complex protocols of actor-system interaction. vrepresent actor -> system messages as triggering events and conditions vrepresent system -> actor messages as actions vPossible to execute (simulate) the state machine to check accuracy and completeness.

ISIISI June G. Falquet, L. NerimaState Machines 38 Example Interaction: The operator can enter commands to control a telescope system, subject to a number of constraints vWhen the telescope is idle, the system may be configured, maintained, or commanded to move. vThe system will not accept a command when the telescope is currently moving except stop or turn off. vWhenever the telescope is moving, monitored position is displayed in a blinking form. vWhen the telescope is stopped, the monitored position is non-blinking. vAfter configuration is complete, the user must reinitialise the system. vTelescope position is displayed on a user-defined periodic basis.

ISIISI June G. Falquet, L. NerimaState Machines 39 Off On Ready entry/Blink(Off) entry/initialise Configuring do_maintenance Moving entry/Blink(On) Waiting tm(UpdateTime)/ p = getPos() display(p) move stop maintain maint_done configure reinitialise turnOn turnOff