03/12/2001 © Bennett, McRobb and Farmer 2002 1 Specifying Control Based on Chapter 11 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and.

Slides:



Advertisements
Similar presentations
Nested state diagrams:Problems with flat state diagram
Advertisements

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.
Introduction to Software Engineering 7. Modeling Behaviour.
© 2010 Bennett, McRobb and Farmer1 Requirements Analysis 1: Requirements and Classes Based on Chapter 7 of Bennett, McRobb and Farmer: Object Oriented.
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.
State Machine Diagrams (State Chart in UML 1) Specifying Control (ref: Chapter 11 Bennett, Mc Robb and Farmer)
03/12/2001 © Bennett, McRobb and Farmer Modelling Concepts Based on Chapter 5 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and.
03/12/2001 © Bennett, McRobb and Farmer Object Interaction Based on Chapter 9 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and.
Requirements Analysis
03/12/2001 © Bennett, McRobb and Farmer Activity Diagrams Based on Chapter 5 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and.
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
03/12/2001 © Bennett, McRobb and Farmer Use Case Diagrams Based on Chapter 6 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and.
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.
COMP1007 Intro to Requirements Analysis © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Introduction to Requirements Analysis Lecture.
SE-565 Software System Requirements More UML Diagrams.
Chapter 9 Introduction to ActionScript 3.0. Chapter 9 Lessons 1.Understand ActionScript Work with instances of movie clip symbols 3.Use code snippets.
State and Sequence Diagrams Modelling dynamic information So far we have seen: Use Case Diagrams – requirements capture, interface.
SYSC 3100 System Analysis and Design1 UML State Machines.
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.
Business Informatics Group Institute of Software Technology and Interactive Systems Vienna University of Technology Favoritenstraße 9-11/188-3, 1040 Vienna,
1 SAD2 - UML 2 nd Lecture Sequence Diagram and other dynamic views Lecturer: Dr Dimitrios Makris
Object-Oriented Systems Analysis and Design Using UML
03/12/2001 © Bennett, McRobb and Farmer Object Interaction Based on Chapter 9 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and.
Systems Analysis and Design in a Changing World, Fifth Edition
University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 state diagrams 1 state machine for the class GradeRate. Movement from one.
Session 22 Modeling the Extended Features of the Statechart Written by Thomas A. Pender Published by Wiley Publishing, Inc. October 27, 2011 Presented.
© Bennett, McRobb and Farmer Requirements Analysis Based on Chapter 7 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and Design.
© Bennett, McRobb and Farmer Avoiding the Problems Based on Chapter 3 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and Design.
7 Systems Analysis and Design in a Changing World, Fifth Edition.
Smith’s Aerospace © P. Bailey & K. Vander Linden, 2005 Interaction and Communication Diagrams Patrick Bailey Keith Vander Linden Calvin College.
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.
Course Instructor: Kashif Ihsan 1. Chapter # 3 2.
Information System Design IT60105
© 2010 Bennett, McRobb and Farmer1 Object Interaction – Interaction Overview Diagrams Timing Diagrams Based on Chapter 09 Bennett, McRobb and Farmer Object.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 8: Modelling Interactions and Behaviour UML Sequence Diagram.
University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams : listCampaigns *[For.
© 2010 Bennett, McRobb and Farmer1 Requirements Analysis 2: Realizing Use Cases Based on Chapter 7 of Bennett, McRobb and Farmer: Object Oriented Systems.
WXGC6102: Object-Oriented Techniques Specifying Control References: Chapter 10 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and Design.
1 Kyung Hee University Statecharts Spring Kyung Hee University Specifying Objects’ Behaviour  Interaction diagrams show message-passing behaviour.
03/12/2001 © Bennett, McRobb and Farmer Modelling Concepts Based on Chapter 5 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and.
Object Oriented Analysis & Design & UML (Unified Modeling Language)1 Part VI: Design Continuous Activity Diagams 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.
© Bennett, McRobb and Farmer Object Interaction – Sequence Diagrams Based on Chapter 9 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis.
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.
Communication Diagrams Lecture 8. Introduction  Interaction Diagrams are used to model system dynamics  How do objects change state?  How do objects.
1 7 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Chapter 7 The Object-Oriented Approach to Requirements.
York University Department of Computer Science © Castro, Mylopoulos and Easterbrook Lecture 11: Modelling “State”  What is State?  statespace.
Object Interaction – Interaction Overview Diagrams Timing Diagrams
Building System Models for RE
Modelling Concepts Based on Chapter 5 Bennett, McRobb and Farmer
State Machine Diagrams
States.
Object Oriented System Design
IMAT5205 Systems Analysis and Design
Week 12: Activity & Sequence Diagrams
Object Interaction – Sequence Diagrams
States.
Systems Analysis and Design I
Presentation transcript:

03/12/2001 © Bennett, McRobb and Farmer Specifying Control Based on Chapter 11 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and Design Using UML, (2 nd Edition), McGraw Hill, 2002.

© Bennett, McRobb and Farmer In This Lecture You Will Learn: n How to identify requirements for control in an application n How to model object life cycles using statecharts n How to develop statechart diagrams from interaction diagrams n How to model concurrent behaviour in an object n How to ensure consistency with other UML models

© Bennett, McRobb and Farmer State n The current state of an object is determined by the current value of the object’s attributes and the links that it has with other objects n For example the class StaffMember has an attribute startDate which determines whether a StaffMember object is in the probationary state

© Bennett, McRobb and Farmer State n ‘A state is a condition during the life of an object or an interaction during which it satisfies some condition, performs some action or waits for some event.... Conceptually, an object remains in a state for an interval of time. However, the semantics allow for modelling "flow-through" states which are instantaneous as well as transitions that are not instantaneous.’ (OMG, 2001)

© Bennett, McRobb and Farmer Statechart The current state of a GradeRate object can be determined by the two attributes rateStartDate and rateFinishDate n An enumerated state variable may be used to hold the object state, possible values would be Pending, Active or Lapsed

© Bennett, McRobb and Farmer Statechart Pending Active Lapsed Transition between states when [rateStartDate <= currentDate] when [rateFinishDate <= currentDate] after [1 year] Final state Initial state Change event GradeRate() Elapsed-time event Statechart for the class GradeRate. Movement from one state to another is dependent upon events that occur with the passage of time.

© Bennett, McRobb and Farmer Types of Event n A change event occurs when a condition becomes true n A call event occurs when an object receives a call to one of its operations either from another object or from itself n A signal event occurs when an object receives a signal (an asynchronous communication) n An elapsed-time event is caused by the passage of a designated period of time after a specified event (frequently the entry to the current state)

© Bennett, McRobb and Farmer Events Commissioned Active authorized(authorizationCode) [contract Signed] /setCampaignActive( ) This event must correspond to an operation in the Campaign class

© Bennett, McRobb and Farmer Actions and Activities State Name entry / action expression exit/ action expression do / activity include / submachine A state may include a sub- statechart Name compartment Internal transition compartmen t Internal actions and activities for a state

© Bennett, McRobb and Farmer Menu Visible State Menu Visible state for a DropDownMenu object Entry action causes the menu to be displayed Event itemSelected() triggers the action highlightItem() Exiting the state triggers hideMenu() While the object remains in the Menu Visible state, the activity causes a sound clip to be played

© Bennett, McRobb and Farmer Statechart for the class Campaign Commissioned authorized(authorizationCode) [contract signed] /setCampaignActive() /assignManager(); assignStaff () Active Completed Paid campaignCompleted() /prepareFinalStatement() paymentReceived(payment) [paymentDue - payment > zero] paymentReceived(payment) [paymentDue – payment <= zero] archiveCampaign() /unassignStaff(); unassignManager() Action-expression assigning manager and staff on object creation Guard condition ensuring complete payment before entering Paid Recursive transition models any payment event that does not reduce the amount due to zero or beyond

© Bennett, McRobb and Farmer A revised statechart for the class Campaign Commissioned authorized(authorizationCode) [contract signed] /setCampaignActive() /assignManager(); assignStaff() Active Completed Paid campaignCompleted() /prepareFinalStatement() paymentReceived(payment) [paymentDue – payment > zero] paymentReceived(payment) [paymentDue - payment = zero] archiveCampaign() /unassignStaff(); unassignManager() paymentReceived(payment) [paymentDue - payment < zero] /generateRefund() If the user requirements were to change, so that an overpayment is now to result in the automatic generation of a refund, a new transition is added

© Bennett, McRobb and Farmer Nested Substates Advert Preparation campaignCompleted() /prepareFinalStatement() Running Adverts Scheduling confirmSchedule() extendCampaign() /modify Budget() advertsApproved() /authorize() Active The Active state of Campaign showing nested substates The transition from the initial pseudostate symbol should not be labelled with an event but may be labelled with an action, though it is not required in this example

© Bennett, McRobb and Farmer Nested States Active include / Running The Active state of Campaign with the detail hidden Hidden decomposition indicator icon The submachine Running is referenced using the include statement

© Bennett, McRobb and Farmer The Active State with Concurrent Substates Advert Preparation Running AdvertsScheduling confirmSchedule() extendCampaign() /modify Budget() advertsApproved() /authorize() Active Survey Evaluation surveyComplete() runSurvey() Running Monitoring campaignCompleted() /prepareFinalStatement()

© Bennett, McRobb and Farmer Concurrent States n A transition to a complex state is equivalent to a simultaneous transition to the initial states of each concurrent statechart n An initial state must be specified in both nested statecharts in order to avoid ambiguity about which substate should first be entered in each concurrent region A transition to the Active state means that the Campaign object simultaneously enters the Advert Preparation and Survey states

© Bennett, McRobb and Farmer Concurrent States n Once the composite states is entered a transition may occur within either concurrent region without having any effect on the state in the other concurrent region A transition out of the Active state applies to all its substates (no matter how deeply nested)

© Bennett, McRobb and Farmer Synchronized Concurrent Threads. Synchronization bar n Explicitly showing how an event triggering a transition to a state with nested concurrent states causes specific concurrent substates to be entered n Shows that the composite state is not exited until both concurrent nested statecharts are exited

© Bennett, McRobb and Farmer Preparing Statecharts n Two approaches may be used: –Behavioural approach –Life cycle approach Allen and Frost (1998)

© Bennett, McRobb and Farmer Behavioural Approach 1. Examine all interaction diagrams that involve each class that has heavy messaging. 2. Identify the incoming messages on each interaction diagram that may correspond to events. Also identify the possible resulting states. 3. Document these events and states on a statechart. 4. Elaborate the statechart as necessary to cater for additional interactions as these become evident, and add any exceptions.

© Bennett, McRobb and Farmer Behavioural Approach 5. Develop any nested statecharts (unless this has already been done in an earlier step). 6. Review the statechart to ensure consistency with use cases. In particular, check that any constraints that are implied by the statechart are appropriate. 7. Iterate steps 4, 5 and 6 until the statechart captures the necessary level of detail. 8. Check the consistency of the statechart with the class diagram, with interaction diagrams and with any other statecharts and models.

© Bennett, McRobb and Farmer Sequence Diagram with Implicit States Campaign Manager listCampaigns() *getCampaignDetails() :CompleteCampaignUI :CompleteCampaign:Client :Campaign showClientCampaigns() selectClient() completeCampaign() campaignCompleted() startInterface() *getClient() Active state Completed state Sequence diagram for use case Set Campaign Completed

© Bennett, McRobb and Farmer Initial statechart for the Campaign class—a behavioural approach Commissioned authorized(authorizationCode) [contract signed] /setCampaignActive() /assignManager(); assignStaff() Advert Preparation Completed Paid campaignCompleted() /prepareFinalStatement() paymentReceived(payment) [paymentDue – payment > zero] paymentReceived(payment) [paymentDue - payment = zero] archiveCampaign() /unassignStaff(); unassignManager() paymentReceived(payment) [paymentDue - payment < zero] /generateRefund() Running AdvertsScheduling confirmSchedule() extendCampaign() /modify Budget() advertsApproved() /authorize()

© Bennett, McRobb and Farmer Revised statechart for the Campaign class Commissioned authorized(authorizationCode) [contract signed] /setCampaignActive() /assignManager(); assignStaff() Advert Preparation Completed Paid campaignCompleted() /prepareFinalStatement() paymentReceived(payment) [paymentDue – payment > zero] paymentReceived(payment) [paymentDue - payment = zero] archiveCampaign() /unassignStaff(); unassignManager() paymentReceived(payment) [paymentDue - payment < zero] /generateRefund() Running AdvertsScheduling confirmSchedule() extendCampaign() /modify Budget() advertsApproved() /authorize() Active

© Bennett, McRobb and Farmer Final version of Campaign statechart Advert Preparation Running AdvertsScheduling confirmSchedule() extendCampaign() /modify Budget() advertsApproved() /authorize() Running Survey Evaluation surveyComplete() runSurvey() Monitoring authorized(authorizationCode) [contract signed] /setCampaignActive() /assignManager(); assignStaff() Paid paymentReceived(payment) [paymentDue – payment > zero] paymentReceived(payment) [paymentDue - payment = zero] archiveCampaign() /unassignStaff(); unassignManager() paymentReceived(payment) [paymentDue - payment < zero] /generateRefund() Active campaignCompleted() /prepareFinalStatement() Commissioned Completed campaignCancelled() /calculateCosts(); prepareFinalStatement() campaignCancelled() /cancelSchedule() calculateCosts(); prepareFinalStatement()

© Bennett, McRobb and Farmer Life Cycle Approach n Consider the life cycles for objects of each class n Events and states are identified directly from use cases and from any other requirements documentation that happens to be available n First, the main system events are listed n Each event is then examined in order to determine which objects are likely to have a state dependent response to it

© Bennett, McRobb and Farmer Life Cycle Approach Steps 1. Identify major system events. 2. Identify each class that is likely to have a state dependent response to these events. 3. For each of these classes produce a first-cut statechart by considering the typical life cycle of an instance of the class. 4. Examine the statechart and elaborate to encompass more detailed event behaviour.

© Bennett, McRobb and Farmer Life Cycle Approach Steps 5. Enhance the statechart to include alternative scenarios. 6. Review the statechart to ensure that is consistent with the use cases. In particular, check that the constraints that the statechart implies are appropriate. 7. Iterate through steps 4, 5 and 6 until the statechart captures the necessary level of detail. 8. Ensure consistency with class diagram and interaction diagrams and other statecharts.

© Bennett, McRobb and Farmer Life Cycle Approach n Less formal than the behavioural approach in its initial identification of events and relevant classes n Often helpful to use a combination of the two, since each provides checks on the other

© Bennett, McRobb and Farmer Consistency Checking n Every event should appear as an incoming message for the appropriate object on an interaction diagram n Every action should correspond to the execution of an operation on the appropriate class, and perhaps also to the despatch of a message to another object n Every event should correspond to an operation on the appropriate class (but note that not all operations correspond to events) n Every outgoing message sent from a statechart must correspond to an operation on another class

© Bennett, McRobb and Farmer Consistency Checking n Consistency checking is an important task in the preparation of a complete set of models n Highlights omissions and errors, and encourages the clarification of any ambiguity or incompleteness in the requirements

© Bennett, McRobb and Farmer Summary In this lecture you have learned about: n How to identify requirements for control in an application n How to model object life cycles using statecharts n How to develop statechart diagrams from interaction diagrams n How to model concurrent behaviour in an object n How to ensure consistency with other UML models

© Bennett, McRobb and Farmer References n UML Reference Manual (OMG, 2001) n Allen and Frost (1998) (For full bibliographic details, see Bennett, McRobb and Farmer)