1 / 21

Outline: Key Concepts & Their UML Notations Basic State Diagram UML Notations Examples Exercises

Fall 2010 CS4310 Requirements Engineering UML: Dynamic Modeling Dr. Guoqiang Hu Department of Computer Science UTEP. 1. Outline: Key Concepts & Their UML Notations Basic State Diagram UML Notations Examples Exercises Nested State Diagram, Nested State Sequence Diagram Activity Diagram.

Télécharger la présentation

Outline: Key Concepts & Their UML Notations Basic State Diagram UML Notations Examples Exercises

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Fall 2010CS4310 Requirements EngineeringUML: Dynamic ModelingDr. Guoqiang HuDepartment of Computer ScienceUTEP 1

  2. Outline: • Key Concepts & Their UML Notations • Basic State Diagram UML Notations • Examples • Exercises • Nested State Diagram, Nested State • Sequence Diagram • Activity Diagram 2

  3. 1 Key Concepts & Their UML Notations 1.1 State model • Describes the sequences of operations of objects that occur in response to stimuli • Consists of multiple state diagrams, one for each class with temporal behavior that is important to an application 1.2State • An abstraction of the values and links of an object: sets of values and links grouped together into a state according to the gross behavior of the object • Ignore attributes that do not affect the behavior of the object, and lump together in a single state all combinations of values and links with the same response to events Insolvent Waiting Dialing Powered Solvent 3

  4. 1.3 Event • An occurrence at a point in time • Can be causally related or unrelated (concurrent) The most common types of event: • Signal event: Sending or receiving a signal (message) • Change event: Caused by the satisfaction of a boolean expression (continuously tested) • when (room temperature < heating set point) • when (room temperature < cooling set point) • Time event: Caused by the occurrence of an absolute time or the elapse of a time interval • when (date = October 28, 2010) • after (10 seconds) 4

  5. 1.4 Event vs. state • Events: points in time • State: intervals in time • All events are ignored in a state, except those for which behavior is explicitly prescribed. The response may include the invocation of behavior or a change of state. power turned off power turned on power turned on time Not powered Powered 1.5 Transitions and conditions • Transitions: An instantaneous change from one state to another • Guard condition: A boolean expression that must be true for a transition to occur (only checked once) 5

  6. 2 Basic State Diagram UML Notation State diagram name State2 … State1 do / activity event / effect event (attribs) [condition] / effect For example: Activities for pop-up menu right button down / display pop-up menu Menu visible Idle right button up / erase pop-up menu cursor moved / highlight menu item 6

  7. Do-activity for copy machine For example: Paper jam do / flash warning light Initial & final state For example: Chess checkmate Black wins White’s turn stalemate white moves black moves Draw stalemate White wins Black’s turn checkmate 7

  8. 3 Examples (1) DoorOpener Opening depress / motor up door open / motor off Closed Open depress / motor up door closed / motor off depress / motor down Closing 8

  9. 3 Examples (2) SmartTrafficLights North/South May go straight North/South May turn left timeout [cars in N/S left lanes] timeout [no cars in N/S left lanes] timeout timeout timeout [no cars in E/W left lanes] East/West May go straight East/West May turn left timeout [cars in E/W left lanes] 9

  10. 4 In-Class Exercises (1) Draw a state diagram for a digital watch (8 minutes) 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 1. 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. 10

  11. 4 In-Class Exercises (1) DigitalWatch Display Current Time Advance / hours=(hours+1) mod 24 Set Hours Advance / min=(min+1) mod 60 Mode button Set Minutes Mode button Mode button 11

  12. 4 In-Class Exercises (2) Draw a state diagram for an office phone when making a call. (15 minutes) Assume that the phone has keys for the digits 0-9, #, and *. It can detect when the receiver is on-hook or off-hook. Hint: The phone is idle when the receiver is on-hook. Based on your past experiences, you can decide the possible states of the phone, for example, dialing, connecting, talking, etc. 12

  13. 4 In-Class Exercises (2) 13

  14. 5 Nested State Diagram, Nested State 14

  15. 5 Nested State Diagram, Nested State (cont’d) 15

  16. 5 In-Class Exercises (3) Draw a state diagram for an automatic transmission (10 minutes). The transmission can be in reverse, neutral, or forward. If it is in forward, it can be in first, second, or third gear. States first, second, and third are nested states of forward. Selecting “N” in any forward gear shifts the transmission to neutral. Selecting “F” in neutral always shifts the transmission to first, In any forward gear, stopping the car always shifts the transmission to first. 16

  17. 5 In-Class Exercises (3) 17

  18. 6 Sequence Diagram 18

  19. 6 Sequence Diagram (cont’d) 19

  20. 7 Activity Diagram 20

  21. 7 Activity Diagram (cont’d) 21

More Related