I'm looking for a good and universal state machine and so far I've found SCXML. It's really simple to use (I mean the configuration) but the source code is archaic - there is no type safety and all collections are raw types. I don't have to say how difficult is to find what actually is stored in those collections. So is there any modern alternative?
-
Are BPMNs like jBPM or Activiti an overkill? – Tomasz Nurkiewicz Nov 28 '11 at 20:28
-
Yes. I tried jBPM and it's huge. I need simple state machine - just like the SCXML, but better (as I said above). A good documentation would be usefull too, since SCXML has practically none. – user219882 Nov 28 '11 at 21:31
-
Have you been looking at http://www.manageability.org/blog/stuff/open-source-statemachine-for-user-interfaces-written-in-java? You could also roll your own, using the State Design Pattern. In combination with enums, this can be quite tersely coded, like http://weblogs.java.net/blog/ryano/archive/2005/01/implementing_th.html – GeertPt Dec 20 '11 at 13:03
-
I used SCXMLExecutor from SCXML and created my own AbstractStateMachine. The result is that I got rid of non-generic collections and still can use advantages of XML configuration and implemented logic. – user219882 Dec 22 '11 at 23:29
-
I've been looking at SCXML for a while, we have JBPM, but it's horrendous... – Jonathan Holloway Jan 21 '12 at 14:19
2 Answers
I have used two State Machine products, where I define a product as something that takes actually creates portions of an operational program.
1) QP ( at http://www.state-machine.com/ ). I used this in 2006 in a Windows C++ communications product. Worked very well, but has a limited number of target platforms. Overall this was the best product, but it can cost money depending on how you use it.
2) State Machine Compiler ( at http://smc.sourceforge.net/ ). I am using this today in an iOS product ( http://dr.edgemoor.com ) written in Objective-C. I came across your question while researching alternatives to SMC. I have not found any.
SMC is less well documented, but also simpler in scope. And it big strength is that it generates code for a number of languages, more than any other solution I have found.

- 61
- 5
-
Thank you for your answer, but I need only pure Java libraries. It means that the state machine engine has to be written in Java and it should be configurable in XML files. – user219882 Jan 21 '12 at 23:25
In java, Apache Commons SCXML may be the best.But you can look up something about scxml4flex, http://code.google.com/p/scxml4flex/

- 11
- 2
-
Since the question was specifically tagged `Java`, does `scxml4flex` really answer the question asked? – Ken White Dec 28 '11 at 03:25
-
It doesn't. I guess Apache Commons SCXML is the best for my purpose but it seems that developers don't intend to refactor the code and write better documentation since they haven't done it yet. – user219882 Dec 28 '11 at 11:41