Replies: 1 comment 2 replies
-
Hi @johnesher , how are you? This state pattern is not directly applied in a statemachine library like python-statemachine. Are the actions of the same event on distinct states the same, or they can differ? If they stay the same, you can easily use the statemachine approach mapping events to actions, and events to all possible transitions. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I'm evaluating state machines for a project controlling some mechanics.
I wish to use the State Pattern, where each state is represented as a class instance which encapsulates all of the actions that can happen within that state.
I have used a different package in the past but it was not well matched to the State Pattern and hence am looking at alternatives.
Many of my states will have multiple methods to handle different Events rather than simple
on_enter(...)
andon_exit(...)
methods, and there are likely to be some 20 states, possibly in a simple hierarchy.Presumably the approach would be to create sub-classes of the
State
class.Can anybody point me towards an example of this approach or comment on how easy or difficult it would be to implement?
Beta Was this translation helpful? Give feedback.
All reactions