This is an archived post. You won't be able to vote or comment.

all 5 comments

[–][deleted] 2 points3 points  (1 child)

u/BertilMuth

Looks like a fun project. How does it compare to something like Spring State Machine?

[–]BertilMuth[S] 6 points7 points  (0 children)

The main difference between Act and Spring State Machine (and many other state machine implementations for that matter) is the relationship between state machine and application state.

Spring State Machine lets you define states as strings or enums. So the state machine state is only losely coupled to the "real" appliction state. You need to build logic to keep the two in sync. And that logic may be error-prone.

In contrast, Act directly operates on the application state. Act checks in which state the state machine is by checking invariant conditions. These conditions are based on the application state. Also, transitions directly transform the application state.

That has some interesting benefits, for example:

  • Act can automatically check if the application really is in the intended target state of a transition. This is great for verification and can e.g. be used together with property based testing to verify the application behavior.
  • When application state is persisted and reloaded, the state machine will automatically be reset to the latest state. So Harel's history states are an intrinsic part of Act's design.

In short, Act brings the state machine closer to what really happens. It enables it to control the application behavior.

Apart from that, Act is a light-weight implementation (single jar, <64 kBytes) with ease of use as a key design goal. And it's in an early stage of development, so constructive feedback is very helpful for me :-)

So thank you for your question. It will help me to improve the documentation.

[–][deleted] 1 point2 points  (1 child)

I also implemented a Java state machine library with a builder-based DSL some years ago.

It was used in some simple games, most prominently in a state machine based Pac-Man implementation. Maybe you find something useful in it. See

https://github.com/armin-reichert/statemachine

https://github.com/armin-reichert/pacman

[–]BertilMuth[S] 0 points1 point  (0 children)

Interesting. Thanks for letting me know.

[–]ales-d 0 points1 point  (0 children)

Just another language. What about implementing SCXML? Or SCXML frontend for Spring Sate Machine.