Presentation is loading. Please wait.

Presentation is loading. Please wait.

NJIT Modeling Behavior in State Chart Diagrams Chapter 29 Rafael Mello.

Similar presentations


Presentation on theme: "NJIT Modeling Behavior in State Chart Diagrams Chapter 29 Rafael Mello."— Presentation transcript:

1 NJIT Modeling Behavior in State Chart Diagrams Chapter 29 Rafael Mello

2 Introduction A State Diagram is drawn to show the life history of a reactive object. A reactive, event-driven, object is one whose behavior is best characterize by its response to events dispatched from outside its context. Objects are usually in a state, ex: Idle, until an event is trigger and makes the object transition from state to state. When that happens, its response usually depends on prior events.

3 Events and States Event – Is an occurrence that triggered the state. A telephone receiver is taken off the hook. State – Is the condition of a object at a specific time. A telephone is on “idle” state until it is taken from the hook.

4 Transitions Transition – Involves going from one state to the other when an event occurs. Transitions are label in form: Event [Guard] / Action When the event “off hook” occurs, transition the telephone from the “idle” state to the “active” state.

5 Statechart Diagrams initial State state transition event A Statechart diagram shows the lifecycle of an object

6 Statechart Diagrams (Cont.) The state diagram on the previous slide illustrates a simple telephone state chart diagram, with states, events and transitions. The states are shown in round rectangles. The transitions are shown with arrows, and the events are the labels in each transition.

7 Use Case Statechart Diagrams The Use Case Statechart diagram is used to describe the sequence of external events that is handled by a system described in a use case scope. Ex: In a Process Sale use case it is not permitted to perform a makeCreditPayment until the endSale event has happened.

8 Classes that benefit from Statechart Diagram In addition to Use Case and system design, the Statechart diagram can be used to describe object state behavior. Object can be state-independent or state- dependant. State-independent objects are objects that always respond the same way to an event. State-dependent objects are object that reacts different to events.

9 When to use Statechart Diagrams The next slide contains a list of common state- dependant objects that might be worth illustrating in a Statechart diagram:

10 Classes that benefit from Statechart Diagram Use Case – View as a class Stateful sessions – Server-side software objects Systems – classes representing the system Windows – window’s action “Edit-Copy” Controllers – GRASP controller objects Transactions – The way transaction respond to events Devices – Microwave oven, Radio Role Mutators – Classes that change its roles.

11 Illustrating External and Interval Events There are three types of events: External Event – Events caused by an outside actor, outside of the system’s boundary. Internal Event – Events caused by an internal action, inside the system’s boundary. Temporal Event – Events caused by a determined date or time clock.

12 Additional Statechart Diagram Notation Additional features UML notation for statechart diagram: Transition actions Transition guard condition Nested states

13 Additional Statechart Diagram Notation (Cont.) Transitions are what makes an action to fire, such as a method invocation. A transition also can have a Boolean test, such as a guard, that only happens if the test succeeds. Nested states represents substates. The substate inherits the transitions of its superstate.

14 Additional Statechart Diagram Notation (Cont.) Example of Transition action and guard notation

15 Additional Statechart Diagram Notation (Cont.) Example of nested states


Download ppt "NJIT Modeling Behavior in State Chart Diagrams Chapter 29 Rafael Mello."

Similar presentations


Ads by Google