Common Modeling Techniques of State Machines

Estudies4you
Common Modeling Techniques 
Modeling the Lifetime of an Object 
To model the lifetime of an object: 
  • A class, a use case, or the system as a whole can be modeled as a state machine 
  • If the context is a class or a use case, find out the neighboring classes (which may include any parents of a class) and any classes that are accessible by associations or dependencies 
  • These neighbors are candidate targets for actions and hence, may figure in guard conditions 
  • Limit the focus to one behavior of the system, if the context is the system as a whole 
  • Including all objects is unpractical and counterproductive even if they participate 
  • Set up the initial and the final states of the object 
  • Provide the pre and the post conditions of the initial and the final states that determine the rest of the model 
  • Choose the events to which the object may respond 
  • If the events are already specified, they can be found in the object's interfaces. Otherwise, consider the objects may be dispatched by that a 
  • Identify the states the object may be in, from the initial to final state 
  • Associate these states using the transitions triggered by the appropriate events 
  • Add actions to these transitions 
  • Identify any entry or exit actions 
  • Expand these states by using substates wherever necessary 
  • Verify that all the events specified in the state machine match the events expected by the interface of the object and vice versa. Some events may be ignored
  • Make sure that all actions mentioned in the state machine are supported by the relationships, methods, and operations of the enclosing object 
  • Trace through the state machine, either manually or by using the tools to check the state machine against expected sequences of events and their responses 
  • Carefully identify unreachable states and those states in which the machine may not respond 
  • Make sure that the object's semantics are preserved


Tags
To Top