Modeling Behavior in Statechart Diagrams

Slides:



Advertisements
Similar presentations
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.
Advertisements

UML State Machine Diagrams and Modeling
State Charts Mehran Najafi. Reactive Systems A reactive, event-driven, object is one whose behavior is best characterized by its response to events dispatched.
ESE Einführung in Software Engineering 7. Modeling Behaviour Prof. O. Nierstrasz.
ZEIT2301 Design of Information Systems Behavioural Design: State Machines School of Engineering and Information Technology Dr Kathryn Merrick.
Introduction to Software Engineering 7. Modeling Behaviour.
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.
University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution.
An Introduction to Rational Rose Real-Time
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.
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.
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 20 Object-Oriented.
Object-Oriented Modeling Using UML CS 3331 Section 2.3 of Jia 2003.
OO Methodology Elaboration Iteration 3 – Part 2 Refining Models.
Drawing System Sequence Diagrams
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.
Dynamic Models. Outline Dynamic Models Statecharts –States –Transitions –Composite states Interaction Diagrams –Sequence Diagrams The time order of interactions.
States.
UML: State Chart Diagrams
State Chart diagram Week objective Describe State chart Diagrams in Dynamic Modelling 2.
Winter 2011SEG Chapter 11 Chapter 1 (Part 1) Review from previous courses Subject 1: The Software Development Process.
INFO 620Lecture #71 Information Systems Analysis and Design Design Class Diagrams and others INFO 620 Glenn Booker.
Chapter 5 System Modeling. What is System modeling? System modeling is the process of developing abstract models of a system, with each model presenting.
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.
Chapter 5 – System Modeling Lecture 9 Section A 27/4/2015 Section B 29/4/2015 1Chapter 5 System modeling.
Dr. Awais Majeed Object Oriented Design and UML.
Chapter 5 – System Modeling Lecture 1 1Chapter 5 System modeling.
EKT 421 SOFTWARE ENGINEERING
CompSci 280 S Introduction to Software Development
Systems Analysis and Design in a Changing World, Fourth Edition
Software Engineering Lecture 4 System Modeling The Analysis Stage.
UML Diagrams By Daniel Damaris Novarianto S..
Chapter 5 System modeling
State Machine Diagram.
Dynamic Modeling of Banking System Case Study - I
Unified Modeling Language
Object-Oriented Systems Analysis and Design Using UML
Chapter 5 – System Modeling
UML Diagrams Jung Woo.
UML State Diagrams.
CS251 – Software Engineering Lectures 11 State Diagrams
Sequence Diagrams.
System models October 5, 2005.
States.
Object Oriented System Design
CS/CPE 426 Senior Projects
Sequence Diagrams Lecture 6.
Unified Modeling Language
Chapter 20 Object-Oriented Analysis and Design
Appendix A Object-Oriented Analysis and Design
CS310 Software Engineering Dr.Doaa Sami
CS/CPE 426 Senior Projects
Dynamic Modeling Lecture # 37.
States.
Chapter 5 – System Modeling
Software Analysis.
CS 791Z State Machines & Advanced State Machines
Chapter 22 Object-Oriented Systems Analysis and Design and UML
CIS 375 Bruce R. Maxim UM-Dearborn
Appendix A Object-Oriented Analysis and Design
Chapter 4 System Modeling.
Appendix A Object-Oriented Analysis and Design
UML State Diagrams (Ch. 29)
Design Model: Creating Design Class Diagrams
Presentation transcript:

Modeling Behavior in Statechart Diagrams

Introduction A state diagram (also state transition diagram) illustrates the events and the states of things: use cases, people, transactions, objects, etc. An event is a trigger, or occurrence. e.g. a telephone receiver is taken off the hook. A state is the condition of an entity (object) at a moment in time - the time between events. e.g. a telephone is in the state of being idle after the receiver is placed on the hook and until it is taken off the hook. A transition is a relationship between two states; It indicates that when an event occurs, the object moves from the prior state to the subsequent state. e.g. when an event off the hook occurs, transition the telephone from the idle state to active state.

State Machine Diagrams Telephone It is common to include an initial pseudo-state which automatically transitions to another state when the instance is created. off hook state idle active A statec diagram shows the life-cycle of an object; what events it experiences, its transitions and the states it is in between events. A state diagram need not illustrate every possible event; if an event arises that is not represented in the diagram, the event is ignored as far as the state diagram is concerned. Thus, we can create a state diagram which describes the life-cycle of an object at any simple or complex level of detail, depending on our needs. on hook event transition

State Machine Diagrams A state diagram may be applied to a variety of UML elements, including: classes (conceptual or software) use cases Since an entire system can be represented by a class, a statechart diagram may be used to represent it. Any UP element (Domain Model, Design model, etc.) may have deploy state diagrams to model its dynamic behavior in response to events.

Use Case State Machine Diagrams addLineItem makeNewSale WaitingForSale EnteringItems (external) system event endSale A statechart diagram that illustrates the legal order of external events is particularly helpful for complex use cases. It is necessary to implement designs that ensure that no out-of-sequence events occur. Possible design solutions include: Hard-coded conditional tests for out-of-order events. Disabling widgets in active windows to disallow illegal events. A state machine interpreter that runs a state table representing use case state diagram. makePayment WaitingForPayment

Classes that Benefit from Statechart Diagrams State-independent and State Dependent Objects An entity is considered to be state-independent if it responds in the same manner to all events. An entity is considered to be state-dependent if it responds differently to events. State diagrams are created for state-dependent entities with complex behavior.

Classes that Benefit from Statechart Diagrams Common State-dependent Classes Use cases: Systems: Windows: Transaction. Dependent on its current state within the overall life-cycle.

Illustrating External and Internal Events External event: caused by something outside a system boundary. Internal event: caused by something inside the system boundary. Temporal event: caused by the occurrence of a specific date and time or passage of time. SSDs illustrate external events. Messages in interaction diagrams suggest internal events. Driven by a real-time or simulated-time clock. Suppose that after an endSale, a makePayment operation must occur within 5 minutes.

Additional Statechart Diagram Notation This is an action fired by the transition guard (condition) [valid subscriber] off hook / play dial tone idle Active on hook

Additional Statechart Diagram Notation Active [valid subscriber] off hook / play dial tone Idle PlayingDialTone Talking connected digit on hook A state allows nesting to contain substates. A substate inherits the transitions of its superstate (the enclosing state). Within the Active state, and no matter what substate the object is in, if the on hook event occurs, a transition to the idle state occurs. complete Dialing Connecting digit

Exercise Draw a statechart of a simple calculator The interface of the calculator is composed of 10 buttons with digits, and 4 buttons with the basic operations (+, -, *, /) The button “C” resets the display The button “=” displays the result Buttons “On” and “OFF”: try to guess.