Replies: 3 comments
-
Another thing this does is it reinforces the separation between transitions and states. Mathematically, an edge of a graph is distinct from the node it's going to so it doesn't make a whole lot of sense to describe an edge (a, b) the same way we describe and edge (c,b) |
Beta Was this translation helpful? Give feedback.
0 replies
-
yes, I agree. I think this is is the intended use of the feature. Go ahead and open the ticket. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Ok yeah that makes a lot of sense. Very cool |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was thinking about why we would ever want the output names to be different than the state names. Especially if its just a one-to-one relationship this doesn't make a lot of sense to me (for example if the outcome is "done" that just always maps to "DoneState" and it seems a little silly/confusing. But I think what we can do is use the outcome to represent the reason why we transitioned. We should never return the same outcome in more than one place.
For example, we have this code (basically) in the search state:
if finished spiral: return "waypoint_traverse"
And this code (basically) in the waypoint state:
if not done: return "waypoint_traverse"
And then when initializing both states we map "waypoint_traverse" to "WaypointState" which is the actual name of the state.
I would suggest we refactor to something like:
in search:
if finished spiral: return spiral_complete_transition
in waypoint:
if not done: return waypoint_not_complete_transition
then somewhere else we define all transition variables (this is a separate issue I guess I just think using raw strings is not a great idea)
Then we actually map both of those transitions to the WaypointState and now when looking at logs and outcomes we'll be able to see exactly why a transition occurred. This is even more useful if you ever transition to the same state in multiple places from within a state then you can have a separate outcome for each place and see exactly where that transition occurred just by looking at what the outcome was.
If we don't want to do this then I think we should just make the outcome names the same as the state names because otherwise it's just an unnecessary mental mapping that people need to do and makes the code harder to understand.
Beta Was this translation helpful? Give feedback.
All reactions