Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS451 Introduction to Software Engineering Behavioral Modeling.

Similar presentations


Presentation on theme: "CS451 Introduction to Software Engineering Behavioral Modeling."— Presentation transcript:

1 CS451 Introduction to Software Engineering Behavioral Modeling

2 Outside world Application events behavior

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 new state event causing transition action that occurs

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

7 Control Model The control flow diagram is "superimposed" on the DFD and shows events that control the processes noted in the DFDThe control flow diagram is "superimposed" on the DFD and shows events that control the processes noted in the DFD Control flowsControl 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 CSPECControl 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 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 Over drafted ok deposit withdraw deposit withdraw

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 entry: entry action exit: exit-action do: activity-A on: event-A: action-A state variable(s)

12 State-A State-B Event(arguments)[condition]/action Transition notation (2) 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 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 Initial state State-B Event(attribute)

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

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

16 Concurrent state diagram for the class Order Checking Waiting Dispatching Authorizing Authorized Checking Waiting Dispatching Authorizing Authorized Cancelled Delivered 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 StateDescription WaitingThe oven is waiting for input. The display shows the current time. Half powerThe oven power is set to 300 watts. The display shows ‘Half power’. Full powerThe oven power is set to 600 watts. The display shows ‘Full power’. Set timeThe 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. DisabledOven operation is disabled for safety. Interior oven light is on. Display shows ‘Not ready’. EnabledOven operation is enabled. Interior oven light is off. Display shows ‘Ready to cook’. OperationOven 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 StimulusDescription Half powerThe user has pressed the half power button Full powerThe user has pressed the full power button TimerThe user has pressed one of the timer buttons NumberThe user has pressed a numeric key Door openThe oven door switch is not closed Door closedThe oven door switch is closed StartThe user has pressed the start button CancelThe user has pressed the cancel button

21 Microwave oven operation


Download ppt "CS451 Introduction to Software Engineering Behavioral Modeling."

Similar presentations


Ads by Google