https://kotlinlang.org logo
#getting-started
Title
# getting-started
c

Chris Fillmore

08/27/2021, 3:44 PM
Is anyone using any Kotlin state machine libraries? any recommendations?
f

FunkyMuse

08/27/2021, 3:57 PM
You can use sealed classes/interfaces to make a state machine, no need of libraries
c

Chris Fillmore

08/27/2021, 3:58 PM
That’s what I’m currently doing, but I’m wondering if there’s something that will help with state transitions
For instance defining which transitions are allowed
f

FunkyMuse

08/27/2021, 4:00 PM
You can use sealed classes and each class can implement allowed/not allowed interface
c

Casey Brooks

08/27/2021, 10:39 PM
Implementing the FSM manually will inevitably lead to a lot of boilerplate in your sealed classes that obscure the actual intent or structure of the FSM. Tinder has a JVM-only FSM library that's pretty good https://github.com/Tinder/StateMachine
c

Chris Fillmore

08/30/2021, 3:09 PM
Thanks for responding… I saw that actually! Didn’t realize Tinder was on GitHub…. but I will check it out, thanks
m

Mikhail Fedotov

09/02/2022, 4:12 PM
This library provides many features and has nice DSL syntax https://github.com/nsk90/kstatemachine
237 Views