Skip to content

Make sure actions get executed when active states are passed as initial states  #8

@aljoshakoecher

Description

@aljoshakoecher

Currently, every state can be passed into the StateMachineBuilder's function withInitialState(State s). This is a problem because right now the actions of these states are not executed. There are two possible ways to fix this:

  1. Make sure every action gets executed on state instantiation (i.e. from the constructor). This would reduce complexity and reflect the common view of action execution in state machines. On the other hand, it leads to problems becauce the current state of the state machine is not updated until the constructor finished creating the new state. When action execution takes a while or leads to an error, there is a problem with the state machine's current state.
    What's worse: The state machine reference would have to be passed in to the constructor making instantiation more problematic.
  2. Allow only waiting states to be passed into withInitialState(State s). This seems to make more sense because the state machine can then not simply start executing but would have to wait for any transition to be fired. Requires editing the inheritance hierarchy.

Metadata

Metadata

Labels

not goodIt's not a real bug but simply not good

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions