1 / 21

CS451 Introduction to Software Engineering

CS451 Introduction to Software Engineering. Behavioral Modeling. Behavioral Modeling. events. behavior. Outside world. Application. Behavioral Modeling. M ake a list of the different states of a system (How does the system behave?)

lixue
Télécharger la présentation

CS451 Introduction to Software Engineering

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. CS451 Introduction to Software Engineering Behavioral Modeling

  2. Behavioral Modeling events behavior Outside world Application

  3. Behavioral Modeling • Make a list of the different states of a system (How does the system behave?) • Indicate how the system makes a transition from one state to another (How does the system change state?) • indicate event • indicate action • Draw a state transition diagram

  4. The States of a System • state—a set of observable circumstances that characterizes the behavior of a system at a given time • state transition—the movement from one state to another • event—an occurrence that causes the system to exhibit some predictable form of behavior • action—process that occurs as a consequence of making a transition

  5. State Transition Diagram Notation state event causing transition action that occurs new state

  6. State Transition Diagram full and start reading invoke manage-copying operator commands full invoke read-op-input copies done invoke read-op-input making copies reloading paper empty invoke reload paper jammed invoke problem-diagnosis not jammed invoke read-op-input problem state

  7. Control Model • The control flow diagram is "superimposed" on the DFD and shows events that control the processes noted in the DFD • Control flows • Events and control items—by dashed arrows • A vertical bar implies an input to or output from a control spec (CSPEC) — a separate specification that describes how control is handled • A dashed arrow entering a vertical bar is an input to the CSPEC • A dashed arrow leaving a process implies a data condition • A dashed arrow entering a process implies a control input read directly by the process • Control flows do not physically activate/deactivate the processes—this is done via the CSPEC

  8. Control Flow Diagram

  9. UML: Behavioral modeling • Activity Diagrams • Statechart Diagrams • Interaction Diagrams

  10. deposit Over drafted withdraw withdraw deposit ok UML: State Diagram • Shows the behavior of one object • How does it change its state based • on the messages it receives, • narrowly focused, fine-grained • State: condition/situation during • lifetime of an object • State transition: relationship • indicating a state change (atomic & • non interruptible) • Action: atomic & non-interruptible

  11. State notation (1) • Substates: disjoint/concurrent • Entry/exit actions • entry: an action that is performed on entry to the state • exit: an action performed on exiting the state • do: an ongoing activity performed while in the state (example: display window) • interruptible • on: an action performed as a result of a specific event State name state variable(s) entry: entry action do: activity-A on: event-A: action-A exit: exit-action

  12. Transition notation (2) Event(arguments)[condition]/action State-A State-B • Event: significant occurrence that has a location in time and space • triggers the transition • signals, calls, passing of time, change in state • Guard condition: • Transition only eligible to fire when guard evaluates to true • Guards of transition exiting one state are mutually exclusive • Action: executable atomic computation

  13. Event(attribute) State-B Initial state State diagram notation (3) • Start state • No event triggers allowed • Branch conditions allowed • May not remain in start states • End state • Top level end state terminates a state machine

  14. State transitions for an order get next item[ not all Item received[ some items checked ] items not in stock ] [ All items checked && some items not in stock ] / get first item Checking Waiting do: check item [ All items checked && Item received[ all items all items available ] available ] Dispatching Delivered Delivered do: initiate delivery

  15. Example: Payment authorization in class Order 2 parallel processes: - authorization - order handling Authorizing [ payment not ok ] do: check payment [ payment ok ] Rejected Authorized Delivered

  16. Concurrent state diagram for the class Order Cancelled Waiting Waiting Dispatching Dispatching Checking Checking Delivered Authorizing Authorizing Authorized Authorized Rejected

  17. Statecharts • Allow the decomposition of a model into sub-models • A brief description of the actions is included following the ‘do’ in each state • Can be complemented by tables describing the states and the stimuli

  18. Microwave Oven Model

  19. Microwave oven state description State Description Waiting The oven is waiting for input. The display shows the current time. Half power The oven power is set to 300 watts. The display shows ‘Half power’. Full power The oven power is set to 600 watts. The display shows ‘Full power’. Set time The cooking time is set to the user’s input value. The display shows the cooking time selected and is updated as the time is set. Disabled Oven operation is disabled for safety. Interior oven light is on. Display shows ‘Not ready’. Enabled Oven operation is enabled. Interior oven light is off. Display shows ‘Ready to cook’. Operation Oven in operation. Interior oven light is on. Display shows the timer countdown. On completion of cooking, the buzzer is sounded for 5 seconds. Oven light is on. Display shows ‘Cooking complete’ while buzzer is sounding.

  20. Microwave oven stimuli Stimulus Description Half power The user has pressed the half power button Full power The user has pressed the full power button Timer The user has pressed one of the timer buttons Number The user has pressed a numeric key Door open The oven door switch is not closed Door closed The oven door switch is closed Start The user has pressed the start button Cancel The user has pressed the cancel button

  21. Microwave oven operation

More Related