Presentation is loading. Please wait.

Presentation is loading. Please wait.

Advanced Behavioral Modeling

Similar presentations


Presentation on theme: "Advanced Behavioral Modeling"— Presentation transcript:

1 Advanced Behavioral Modeling

2 Plan of Talk State Machine Statechart Diagrams

3 State Machines Interaction Diagrams – Society of Objects
State Machine – Individual object It specifies life time of instances of class, use case or an entire system Events corresponds to signal, operation or passing of time Activity – nonatomic execution Action – executable atomic computation Visualization of State Machines Activity Diagrams Statechart Diagrams

4 Usage of State Machines
When one object is acted on other object by a synchronous operation call, they do not need state machine to specify their behavior They apply to objects that must respond to signals, which are asynchronous stimuli communicated between instances Ultimately The behavior of objects that must respond to asynchronous stimulus Or whose current behavior depends on their past is best specified by using a state machine

5 Terms Usage – To model the behavior of use case, interface State
situation during the life of an object during which it satisfies some condition, performs some activity, or waits for some event Its Parts- Name entry/exit actions Internal Transitions Substates Deferred events What are pseudostates?

6 Terms

7 Terms Transitions relationship between two states
On such a change of state, the transition is said to fire from source state to target state Parts Source state Event trigger Guard condition Action Target state

8 Terms Advanced State and Transitions
Entry actions- No matter which transition led you there Exit actions- No matter which transition led you away Internal transitions- the event is handled without dispatching the state's exit and then entry actions. Activities- Ongoing work in state Deferred events-want to recognize some events but postpone a response to them by queuing the events

9 State MACHINE S T U D E N O B J C

10 Substates Validating and Processing are called sequential,
It is a state that's nested inside another one A state that has substates that is, nested states is called a composite state. A nested sequential state machine may have at most one initial state and one final state. Validating and Processing are called sequential, or disjoint, substates.

11 Substates Dialing a number on a telephone Line

12 History substate To remember the last substate that was active prior to leaving the composite state e.g. unattended backup of computers H designates a shallow history, which remembers only the history of the immediate nested state machine. deep history denoted as H* remembers the innermost nested state at any depth If nested state machine reaches a final state, it loses its stored history

13 History substate

14 Concurrent Substates Allows to specify two or more state machines that execute in parallel in the context of the enclosing object OR model concurrency is by using active objects Each Concurrent Substates further decomposed into sequential substates

15 Concurrent Substates

16 Statechart Diagrams A statechart diagram shows a state machine
An activity diagram is a special case of a statechart diagram in which all or most of the states are activity states and all or most of the transitions are triggered by completion of activities in the source state Statechart Diagram shows flow of control from state to state This involves modeling the behavior of reactive objects Reactive object - is one whose behavior is best characterized by its response to events dispatched from outside its context

17 Statechart Diagrams

18 Elements of Statechart Diagram
Simple states Composite states Transitions including events and actions A statechart diagram may contain any and all features of a state machine

19 Usage To model the dynamic aspects of a system, a class, or a use case
To model reactive objects or event-driven object It is typically idle until it receives an event The behavior can be specified by the stable states in which that object may live the events that trigger a transition from state to state The actions that occur on each state change These events may also be trigger self- and internal transitions

20 To model reactive object
Choose the context for the state machine, whether it is a class, a use case, or the system as a whole Choose the initial and final states for the object. To guide the rest of your model, possibly state the pre- and postconditions of the initial and final states, respectively. Decide on the stable states of the object by considering the conditions in which the object may exist for some identifiable period of time. Decide on the meaningful partial ordering of stable states over the lifetime of the object Decide on the events that may trigger a transition from state to state. Model these events as triggers to transitions that move from one legal ordering of states to another.

21 To model reactive object
Attach actions to these transitions (as in a Mealy machine) and/or to these states (as in a Moore machine) Consider ways to simplify your machine by using substates, branches, forks, joins, and history states. Check that all states are reachable under some combination of events Check that no state is a dead end from which no combination of events will transition the object out of that state. Trace through the state machine, either manually or by using tools, to check it against expected sequences of events and their responses.

22 Parsers that stream in and stream out meassages to XML
Statechart diagram for parsing a simple context-free language, message : '<'string '>'string ';'

23 Forward and Reverse Engineering
It is possible especially if the context of the diagram is a class. Using the previous statechart diagram, a forward engineering tool could generate the Java code for the class ‘X’ The forward engineering tool must generate the necessary private attributes and final static constants Reverse Engineering is not possible but it allows animation of a model against the execution of a deployed system


Download ppt "Advanced Behavioral Modeling"

Similar presentations


Ads by Google