# Common state machine for multi platform

**URL:** <https://discuss.kotlinlang.org/t/common-state-machine-for-multi-platform/11396>\
**Category:** Libraries\
**Created:** [January 31, 2019, 10:00am UTC](https://discuss.kotlinlang.org/t/common-state-machine-for-multi-platform/11396 "2019-01-31T10:00:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![igal.1](https://avatars.discourse-cdn.com/v4/letter/i/ac91a4/32.png) [@igal.1](https://discuss.kotlinlang.org/u/igal.1)\
**Post date:** [January 31, 2019, 10:00am UTC](https://discuss.kotlinlang.org/t/common-state-machine-for-multi-platform/11396/1 "2019-01-31T10:00:12Z")

</div>

I am planning on refactoring base code. Part of the refactoring is leveraging the Kotlin multiplatform capabilities.  
I need a common library for implementing many kinds of state machines (Concurrent / Hierarchical).  
I could not find a common library for a state machine.  
I thought about these options:

1. Convert a Java library to Kotlin and make it common
2. Convert a native state machine to common Kotlin
3. Write interfaces for accessing state machine and implement/use state machine per platform from a common code
4. Write a common Kotlin state machine framework from scratch

Is anyone familiar with a common state machine library? what is the best option?

Thanks,  
Igal
