Statechart Diagrams
✱A Statechart Diagrams illustrates a state machine, highlighting the flow of control from one state to another state.
Contents
- Statechart diagram contains
➤Simple states and composite states
➤Transitions, including events and actions
- It also contains notes and constraints
To model reactive objects
- Reactive object is idle till it receives an event
- When an event is received the response depends on previous events
- After responding, the object becomes idle again
Common Modeling Techniques
Modeling Reactive Objects To model a reactive object:
- A class, a use case or the system as a whole can be modeled as a state machine
- Select the initial and final states for the object
- Indicate the pre and the post conditions of the initial and the final states that define what the modeled component (class, use case, etc.) should do
- Establish the stable states of the object by considering the conditions in which the object may be present for some significant amount of time
- Starting with the high level states of the object, identify their substates
- Decide on the significant partial ordering of stable states over the lifetime of the object
- Decide on the events that trigger the transitions from one state to another state
- Model these events as triggers to different transitions that shift from one legal ordering of states to another
- Add actions to these transitions/states. Find out ways to simplify the machine by the use of branches, joins, forks, history states, and substates
- Make sure that all the states are reachable with some sequence of events and their corresponding transitions
- Verify that no state is a dead end from which no sequence of events will transition the object out of that state
- Trace through the state machine, either manually or by using the tools so as to check it against important sequences of events and their responses
- The image shows the statechart diagram for determining a simple context-free language message : '<' string '>' string ';'
- The first string indicates a tag; the second string represents the body of the message
Post a Comment
Post a Comment