You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I wanna bounce of you a design question, since im trying to rewrite "implicit" state machine to explicit one
Usually the code looks like this
fun foo() {
if (currentState == Bar) {
doSomething()
currentState = Quax
}
}
What I usually see is people having transition function, which according to input action changes state, but however it would do so before doSomething is ran, to me which is a problem
since currentState will be observable, and subscribers expect doSomething to have ran if state is Quax
Do I need some PRE + POST_state pairs or something? Seems weird for synchronous code
What would be your solution?
The text was updated successfully, but these errors were encountered:
So, you are baking the statemachine inside StateManager, which then you can run those sideffects before transitions, great
However, this messes up testing, as you can only test StateManager, and statemachine become implmentation details, which is maybe okay
But you lose ability to set initialState, unless you pass it in via StateManager ctor, which is bad, since youre leaking your implementation detail to call sites
Hi, I wanna bounce of you a design question, since im trying to rewrite "implicit" state machine to explicit one
Usually the code looks like this
What I usually see is people having transition function, which according to input action changes state, but however it would do so before doSomething is ran, to me which is a problem
since currentState will be observable, and subscribers expect doSomething to have ran if state is Quax
Do I need some PRE + POST_state pairs or something? Seems weird for synchronous code
What would be your solution?
The text was updated successfully, but these errors were encountered: