Dynamic Models. Outline Dynamic Models Statecharts –States –Transitions –Composite states Interaction Diagrams –Sequence Diagrams The time order of interactions.

Slides:



Advertisements
Similar presentations
StateChart Diagrams State Machines Overview Change summary –core constructs –notation Examples Backward compatibility User benefits Issues.
Advertisements

State Charts Mehran Najafi. Reactive Systems A reactive, event-driven, object is one whose behavior is best characterized by its response to events dispatched.
Concepts & Notations. Acknowledgements  The material in this tutorial is based in part on: Concurrency: State Models & Java Programming, by Jeff Magee.
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.
1 Behavioral Modeling Chapter 8. 2 Key Ideas Behavioral models describe the internal dynamic aspects of an information system that supports business processes.
Dynamic Modeling. Dynamic Modeling with UML Interaction diagram –Dynamic behavior of a set of objects arranged in time sequence –Interaction between objects.
© 2006 ITT Educational Services Inc. SE350 System Analysis for Software Engineers: Unit 9 Slide 1 Appendix 3 Object-Oriented Analysis and Design.
State Transition Diagrams
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.
Sequence Diagrams. Introduction A Sequence diagram depicts the sequence of actions that occur in a system. The invocation of methods in each object, and.
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.
Interaction Diagrams Activity Diagram State Machine Diagram
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 5, Analysis: Dynamic Modeling.
Software engineering Methods Software Engineering Methods State Diagrams Zvi Avidor Written By With additions by Zvika Gutterman and Adam Carmi.
Essentials of interaction diagrams Lecture 23 & 24.
THE OBJECT-ORIENTED DESIGN WORKFLOW Statechart Diagrams.
UML Sequence Diagrams Eileen Kraemer CSE 335 Michigan State University.
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.
Slide 1 Chapter 8 Behavioral Modeling. Slide 2 Key Ideas Behavioral models describe the internal dynamic aspects of an information system that supports.
SE-565 Software System Requirements More UML Diagrams.
UML Sequence Diagrams Michael L. Collard, Ph.D. Department of Computer Science Kent State University.
State and Sequence Diagrams Modelling dynamic information So far we have seen: Use Case Diagrams – requirements capture, interface.
Chapter 10 State Machine Diagrams
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 8: Modelling Interactions and Behaviour.
1 Object-Oriented Modeling Using UML (2) CS 3331 Fall 2009.
UML / UML 2.0 Diagrams (Part III) 1. Sequence diagram is the most common kind of interaction diagram. It focuses on the message interchange between a.
Software Engineering 1 Object-oriented Analysis and Design Chap 29 UML State Machine Diagrams and Modeling.
Fall 2010 CS4310 Requirements Engineering UML: Dynamic Modeling Dr. Guoqiang Hu Department of Computer Science UTEP 1.
1 Software Engineering Dr. K. T. Tsang Lecture 8 State modeling
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 25. Review Design Level Class Diagram Identifying classes/Operations/Attributes Associations – Simple associations.
Object-Oriented Modeling Using UML CS 3331 Section 2.3 of Jia 2003.
1 Modeling interactions and behavior Lecturer Dr. Mai Fadel.
Behavioral Modeling Chapter 8.
1 A Student Guide to Object- Oriented Development Chapter 7 State Diagrams.
7 Systems Analysis and Design in a Changing World, Fifth Edition.
The Unified Modeling Language Part II Omar Meqdadi SE 2730 Lecture 9 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
OO Methodology Elaboration Iteration 3 – Part 2 Refining Models.
1 Kyung Hee University Statecharts Spring Kyung Hee University Specifying Objects’ Behaviour  Interaction diagrams show message-passing behaviour.
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.
Dynamic Modeling Grady Booch, James Rumbaugh, and Ivar Jacobson, The Unified Modeling Language User Guide, 2 nd edition, Addison Wesley, 2005.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 26. Review UML behavioral Diagrams – Sequence diagram.
Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall Object-Oriented Systems Analysis and Design Using UML Systems Analysis and Design,
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.
MCS 270 Spring 2014 Object-Oriented Software Development.
Modeling Object Lifecycles and State-Dependent Behavior ©SoftMoore ConsultingSlide 1.
Dynamic Models - Page L M.E. Fayad Lesson 30: Dynamic Models Object- Oriented Modeling & Application s.
The Dynamic Analysis Model StateCharts Prof. Hany H. Ammar, CSEE, WVU, and Dept. of Computer Science, Faculty of Computers and Information, Cairo University.
Project 2: Phase 1 Submission 7 Late submissions 10% 10 No submissions 14% Better than project 1 phase 3 submissions 10-point bonus: If you catch the deadline.
State Modeling. Introduction A state model describes the sequences of operations that occur in response to external stimuli. As opposed to what the operations.
State transition modeling
State Diagram – Advanced Concepts
Marlon Dumas Institute of Computer Science
Dynamic Modeling of Banking System Case Study - I
Object-Oriented Systems Analysis and Design Using UML
Activity and State Transition Diagram
Object Oriented Modeling and Design
State Machine Diagrams
UML State Diagrams.
CS251 – Software Engineering Lectures 11 State Diagrams
Business System Development
States.
Object Oriented System Design
Marlon Dumas Institute of Computer Science
States.
Modeling Behavior in Statechart Diagrams
Presentation transcript:

Dynamic Models

Outline Dynamic Models Statecharts –States –Transitions –Composite states Interaction Diagrams –Sequence Diagrams The time order of interactions between objects –Communication Diagrams Messages passed between objects

Dynamic Models Used to show software control –Sequence of operations and events –Transitions between states Used to show dynamic relationships between objects in the system –Messages –Interfaces

Modeling Dynamic Behavior Statechart diagram –Depicts the flow of control using states and transitions –Generalization of finite state machines Two types: –Behavioral: the states and transitions; used to describe all objects with complex behavior –Protocol: shows the legal transitions for an abstract classifier such as a port (not discussed)

Statechart Diagram Network of states and transitions One diagram for each object with important dynamic behavior Independent timing of state machines for different objects (asynchronous)

Elements of Statechart Idle Initial State Running Final State State Transition

Initial and final White’s turn Black’s turn Black moves White moves start Black Win Draw White Win checkmate stalemate

State All objects have state State is an abstraction of the values maintained by the object that determine behavior Examples:

State corresponds to interval of time between events Events: points in time State: interval of time; may correspond to a continuous activity –eg waiting; eg ringing; eg flying State may be associated with value of object satisfying some condition –eg automobile transmission is in reverse –eg balance of account is negative

Defining state: Ignore attributes that don't affect behavior Combine set of attributes that form a parameter of the control –eg the control is not changed by changing the digits in the phone call

State Specification Entry: –Action performed on entry to state Exit: –Action performed on exit from state Do: –Action performed while in the state Name Internal Activities Internal Transitions Login entry/type ‘login’ exit/login (username,password) do/get username and password

Events Something that happens at a point in time Stimulus from one object to another May result in a change of state May result in event being sent to another object

Events are not subroutine calls One way transmission of information –obj1 sends event to obj2 –obj2 sends event to obj1 –two different events Events are grouped via generalization –the phone that rings depends on which digits are dialed, but the event is "digit dialed"

Transitions have Source State Event Trigger Guard Condition Action Target State

Transitions Keypress [key=Enter key] / str <= input_buffer Every transition in a statechart should be labeled. Source Event [Condition] / Action Target

Transitions Lead from one state to another Instantaneous

Conditions and Guarded Transitions Event [condition]

Phone Example dial digit(n) [incomplete] Dialing Connecting busy connected dial digit(n) [valid] / connect dial digit(n) [invalid] Invalid Ringing Busy

Another Example anomaly Normal Recovery Identification Pressure Recovery Temperature Recovery recovery success recovery success anomaly= temperature anomaly= pressure recovery failure recovery failure recovery failure

Composite States anomaly Normal Recovery Identification Pressure Recovery Temperature Recovery recovery success done temperature pressure Recovery recovery failure

Composite States (Cont.) Used to simplify diagrams Inside, looks like statechart May have composite transitions May have transitions from substates Sequential and parallel

Composites and Transitions Idle Maintenance Printing Selecting Processing Validating Transition from substate Transition to/from composite state Active

Including Composite States Start entry / start dial tone exit / end dial tone Partial Dialing entry / number.append(n) digit(n) [number.isValid()] Dialing Dial Number Include / Dialing

Parallel Composition Concurrency (split of control) Synchronization substate1substate2 Superstate substate3substate4

Example HW1HW2 Incomplete Project MidtermFinal Passed Failed fail

Example of Synchronization OffOn On/StopOn/Play Off On Off Play Stop Remote Control On Off Off/Stop Play Stop MP3 Player On OffStop Play

Example Parallel Idle Command Testing Waiting Diagnose Join Fork Composite state Maintaining Testing Commanding Concurrent States

In Class: Digital Watch Draw a statechart for a digital watch The watch has a single mode button and a single advance button. Pressing the mode button once and then pressing the advance button increments the hours by 1. Each press of the advance button increments the hour. Pressing the mode button the second time allows advancing the minutes by one. Pressing the mode button a third time displays the current time. While displaying the current time, the advance button is ignored. Pressing the mode button allows the user to set the hour again.

In Class: Office Phone Draw a statechart describing the operation of an office phone. Assume that the phone has keys for the digits 0-9, #, and *. It can detect when the receiver is on-hook or off-hook The phone is idle when the receiver is on- hook. Model phone calls. –making calls (e.g., dialing, connecting, talking), –receiving calls (e.g., ringing, talking)

Substates Used to simplify diagrams Sequential and parallel Inside, looks like statechart May have composite transitions May have transitions from substates

In-class: Toy Electric Train Power is off, train is not moving. Power turned on, train moves forward, headlight shines Power turned off, train stops, headlight goes out. Power turned on, headlight comes on, train does not move. Power turned off, headlight goes off. Power turned on, headlight comes on, train moves backward. Power turned off, headlight goes off, train stops. Power turned on, headlight on, train doesn’t move. Power turned off, headlight off. Power turned on, train moves forward, headlight on.

Interaction Diagrams 4 types –Sequence Diagrams The time order of interactions between objects –Communication Diagrams Messages passed between objects –Interaction Overview Diagram Overview diagram that hides much of the detail –Timing Diagram Interactions with precise time axis

Sequence diagram Depicts object interaction by highlighting the time ordering of method invocations Describes a sequence of method calls among objects (This is the only interaction diagram we ’ ll look at)

Sequence Diagrams Outside Actor :Kiosk Insert Card(Customer) PickDate(date) Active Object Lifeline Time Message

Example (Cont.) Sequence of message sending

Sequence Diagrams Outside Actor :Kiosk :Server :CreditService Insert Card(Customer) PickDate(date) Offer (seatChoice) Select (seats) Submit(order) Charge (customer, amount) authorize OK Print(order)

Sequence Diagrams Caller :Order :TicketDB :Account Create Reserve Offer (seatChoice) Select (seats) Submit(order) Debit Bonus Return Destruction Recursive Call lifeline

Scenario Sequence of events that occurs in one particular execution Same def we used for use cases It is common (necessary) to group events into classes event: airline flight departs

Phone Call Scenario Caller lifts receiver Dial tone begins Caller dials digit (5) Dial tone ends Caller dials digit (5) Caller dials digit (1) Caller dials digit (2) Caller dials digit (3) Caller dials digit (4) Called phone begins ringing Ringing tone in calling phone Called party answers Called phone stops ringing Ringing tone ends in calling phone Phones are connected Called party hangs up Phones are disconnected Caller hangs up

Sequence Diagram caller CalleePhone Line Caller lifts receiver Dial tone begins Dial tone ends Dials (5) Ringing tone connected Tone stops Ringing stops answers Phone rings Dials (5) Dials (1) Dials (2) Dials (3) Dials (4) Hang up