1 A Student Guide to Object- Oriented Development Chapter 7 State Diagrams.

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

Behavioral Modeling: State Diagrams CIS 4800 Kannan Mohan Department of CIS Zicklin School of Business, Baruch College Copyright © 2009 John Wiley & Sons,
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.
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.
© 2006 ITT Educational Services Inc. SE350 System Analysis for Software Engineers: Unit 9 Slide 1 Appendix 3 Object-Oriented Analysis and Design.
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.
Chapter 12 ATM Case Study, Part 1: Object-Oriented Design with the UML
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 5, Analysis: Dynamic Modeling.
SE 555 Software Requirements & Specification 1 Activity Diagrams.
March R. McFadyen1 Statechart Diagram A Statechart Diagram describes states for an object how/why an objects’ state changes A Statechart Diagram.
Software engineering Methods Software Engineering Methods State Diagrams Zvi Avidor Written By With additions by Zvika Gutterman and Adam Carmi.
Chapter 8: Modelling Interactions and Behaviour
Essentials of state and activity diagram Lecture 24.
State Machine Diagrams (State Chart in UML 1) Specifying Control (ref: Chapter 11 Bennett, Mc Robb and Farmer)
2007ACS-3913 R. McFadyen1 UML Statechart Diagram A UML Statechart Diagram describes states for an object how/why an objects’ state changes A Statechart.
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.
Nov 2002 R. McFadyen1 Statechart Diagrams - Ch 29 Example: Suppose we have a class Copy, representing copies of books. We can consider two states:
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.
Oct R. McFadyen1 Statechart Diagrams Example: Suppose we have a class Copy, representing copies of books. We can consider two states: available,
SE-565 Software System Requirements More UML Diagrams.
State and Sequence Diagrams Modelling dynamic information So far we have seen: Use Case Diagrams – requirements capture, interface.
Lecture 4 Finite State Machine CS6133 Software Specification and Verification.
Chapter 10 State Machine Diagrams
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 8: Modelling Interactions and Behaviour.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 8: Modelling Interactions and Behaviour.
OBJECT AND CLASES: THE BASIC CONCEPTS Pertemuan 8 Matakuliah: Konsep object-oriented Tahun: 2009.
1 Object-Oriented Modeling Using UML (2) CS 3331 Fall 2009.
Slide 16B.51 © The McGraw-Hill Companies, 2005 Object-Oriented and Classical Software Engineering.
State diagrams Interaction diagrams –Sequence diagrams –Collaboration diagrams Object orientation Part 4: Dynamic Modeling.
NJIT Modeling Behavior in State Chart Diagrams Chapter 29 Rafael Mello.
1 Software Engineering Dr. K. T. Tsang Lecture 8 State modeling
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 9: Interaction.
Behavioral diagrams Lecture p4 T120B pavasario sem.
Object-Oriented Modeling Using UML CS 3331 Section 2.3 of Jia 2003.
CSIS3600 System Analysis and Design Statechart Diagrams.
Course Instructor: Kashif Ihsan 1. Chapter # 3 2.
Information System Design IT60105
A Student Guide to Object- Oriented Development Chapter 10 Designing objects and classes.
1 Kyung Hee University Statecharts Spring Kyung Hee University Specifying Objects’ Behaviour  Interaction diagrams show message-passing behaviour.
CSCI-383 Object-Oriented Programming & Design Lecture 12.
Dynamic Models. Outline Dynamic Models Statecharts –States –Transitions –Composite states Interaction Diagrams –Sequence Diagrams The time order of interactions.
States.
CS3773 Software Engineering Lecture 06 UML State Machines.
State Chart diagram Week objective Describe State chart Diagrams in Dynamic Modelling 2.
 Engineering Quality Software.  Today o State Diagrams Jerry Kotuba SYST30009-Engineering Quality Software 2.
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.
 The Sequence Diagram models the collaboration of objects based on a time sequence.  It shows how the objects interact with others in a particular scenario.
York University Department of Computer Science © Castro, Mylopoulos and Easterbrook Lecture 11: Modelling “State”  What is State?  statespace.
State Modeling. Introduction A state model describes the sequences of operations that occur in response to external stimuli. As opposed to what the operations.
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.
State Machine Model.
State Machine Diagrams
UML State Diagrams.
CS251 – Software Engineering Lectures 11 State Diagrams
Business System Development
States.
Object Oriented System Design
Chapter 5 state Modeling
States.
CHAPTER 2 Object-Oriented Modeling Using UML (Continued)
UML State Diagrams.
Appendix 3 Object-Oriented Analysis and Design
Presentation transcript:

1 A Student Guide to Object- Oriented Development Chapter 7 State Diagrams

2 State diagram In sequence diagrams you are looking at all the classes affected by one use case In state diagrams you are looking at one class across all use cases and how it is effected by the events in the system

3 State diagrams are increasingly widely used to model the ways that a system can respond to external events All objects of the class (the individual customers or products) have the same range of ways in which they can behave, but the actual way an individual object does behave during the running of the system depends on the sequence of events that it experiences. State diagrams look at how a class is affected by the different use cases in the system and how the objects of the class behave in response to events that affect them. They model the behaviour of one object across several use cases. State diagram

4 State Diagram A state diagram only ever describes the behaviour of a single class illustrating how its objects behave during their lifetimes and how they react to all uses cases in which they are involved. State diagrams also model the order that events affect an object in e.g. in the Wheels system the bike must be assigned a number before it can be hired In most systems only a few of the classes are complicated enough to merit a state diagram. These are classes where the response of an object of the class to a particular event varies depending on the state the object is in at the time State diagrams are also referred to as state charts and state transition diagrams

5 States and Events State - The state of the object here refers to the situation it is in while satisfying some condition (such as a bank account having some money) or waiting for an event (such as someone trying to withdraw or deposit money). Event - An event is something that happens which has significance for the system and affects an object of at least one of the system’s classes. We can tell if an object is in a particular state by looking at the values of some of its attributes and its links to other objects.

6 The state of an object We can tell if an object is in a particular state by looking at the values of its attributes For example, if a Bank Account object is in credit the value of the balance attribute will be a positive amount or zero, but if it is overdrawn the value of balance will be negative. In the Wheels case study, we can tell if a bike is hired out because there will be a link from the Bike object to an active Hire object.

7 start state stop state transition from one state to another self-transition (no change of state) event [guard] / action transition label (each of the three parts is optional) state

8 state diagram for a bank account class State diagram for a bank account class Start state stop state Event fires a transition Self transition Guard

In the "In credit" state 9

UML and C++ A Practical Guide To Object-Oriented Development State Model State Model describes the sequence of states that an object goes through during its lifetime in response to events. Includes the objects responses to events –Actions Single act performed by the object –Activities Continuous set of actions performed by an object

UML and C++ A Practical Guide To Object-Oriented DevelopmentState This represents a stage in the lifecycle of an object. Technically the period of time during which an object is waiting for an event to occur. The internal state of an object is the combination of the data values of the attributes of object.

UML and C++ A Practical Guide To Object-Oriented DevelopmentEvent An event is a condition that can be detected by an object. From an programmatic perspective –An event is a one way asynchronous transmission of information from one object to another. –The information may have parameters with names and types as part of the message sent

UML and C++ A Practical Guide To Object-Oriented DevelopmentTransition A transition is a response by an object to an event received by it. –The response can be a change to a new object state a change to the same object state the performance of some action The ability of the object to respond to a given event is described by guard conditions.

UML and C++ A Practical Guide To Object-Oriented DevelopmentAction An action is an activity or operation that is done inside a state or on a transition between states An action is –atomic –instantaneous An action can occur –during a transition –on entry to a state, –during the entire period an object is in a state, –on exit from a state, –on arrival of an event that does not cause a state transition

UML and C++ A Practical Guide To Object-Oriented DevelopmentActivity An activity is an operation or set of operations that executes during the entire time an object is in a state. An activity is not atomic. An activity can be interrupted by an event while it is executing

Events for Bike Object 16

Completed state diagram for Bike Object 17

18 State diagrams – key words ‘after’ – used to show an event taking place after a specified time period e.g. after [6 months] / delete ‘when’ – event takes place when a condition is satisfied e.g. when [all items in stock] / fill order

19 State diagrams – entry and exit events offHook entry / start dialling tone exit / stop dialling tone do / emit dialling tone Keyword ‘do’ – behaviour that lasts for the duration of a state is called an activity, it is modelled using the keyword ‘do’

UML and C++ A Practical Guide To Object-Oriented Development Nested State Diagram

UML and C++ A Practical Guide To Object-Oriented Development Nested Concurrent Substates

UML and C++ A Practical Guide To Object-Oriented Development Nested Concurrent Substates

UML and C++ A Practical Guide To Object-Oriented Development Mealy model for Microwave Oven

UML and C++ A Practical Guide To Object-Oriented Development Moore model