-
Notifications
You must be signed in to change notification settings - Fork 130
Description
Appccelerate’s base extension methods are a great debugging tool. I use them all the time to help debug new state machines or state machines being modified or enhanced.
In a hierarchical state machine with deeply nested substates, it can be quite difficult to debug issues where multiple substates respond to the same event (with or without guards).
For example, suppose C is a substate of B, B is a substate of A, and all have an event handler with guard for event E. If E is fired from state C and C’s guard fails, then B’s E event handler is called. If B’s guard fails, then A’s E event handler is called.
Because each state’s event handler guard can be based on different conditions, and result in different actions/transitions when the guard succeeds, it can be difficult to trace the state machine’s behavior in response to event E.
It would be valuable if you could provide a new base extension method, HandledIn (or some suitably named method), that returns the state that ultimately handled the most recently fired event. In the above example, if event E is fired from state C, and state C and B’s event handlers’ guards failed, but state A’s event handler’s guard succeeded, then HandledIn would return state A. If state A’s event handler’s guard also failed, then HandledIn would return null (unhandled event).
Thanks,
Paul