SCXML can be used for many different projects or tasks. If you need state machine behavior for your software then this notation should be able to satisfy your needs. I am sure this page will be extended to show many other business cases where SCXML can be used or is in use.

Here some Business Stories/Uses:

Developing a State Oriented Business Protocol

IBM had BPEL [1] by the time I was looking to solve a problem for my Company when I found commons-scxml and I realized after been in touch with the creator (Rahul) how well Harel Statecharts could be to get my task done.

The implementation for a State Oriented Business Protocol is not that hard to be done and basically I did one using a POJO approach. Using some of the libraries from commons like Digester I parse my static business rules from an xml file. Then, using scxml notation I created all the logic in terms of dynamic configurations and execution of specific actions.

Since the project was intended to offer clients the possibility of sending GET/POST HTTP calls and receive XML as the response I just needed to create a Bridge to communicate actions comming to my servlet container to the SCXML Engine. It was easy using reflection to discover which event I had to trigger. Before passing to the SCXML Engine some preconditions can be chequed in that Bridge. After the control is given to the SCXML some post conditions can be evaluated by means of action states. Finally from those action states the SCXML Engine puts the framework in a given State from which only some events will be allowed.

Developing YAWF (Yet Another WEB Framework)

After I developed the above system I came up with an idea that is already explained in my blog [2], but basically I am planning to have my clients use just the VIEW part of the MVC framework I already built using SCXML as Controller.

This is not just a new Framework for Web development. This is a language independent framework where the separation of concerns is of course the main reason to go for it. However why I just do not think about using Sprint or moving into Ruby On Rails for my next project? First I need State Orientation. Second why I have to study a Framework if with simple POJOs that are around or you can build by yourself you end up having the needed behaviour with the needed features.

Yes programming is about fun. Project management, Systems Architecture and Business implementation should be as well right? The truth is business is not defined by software aware people (at least not most of it), Presentation Logic is commonly confused with look and feel and the last is only the final result of a plan that a Front End developer just follow. How you manage to store your data, where and when is not a concern of the business or operations guys. The list can go on. I have found that with commons-scxml and POJOs you end up having a good State Oriented Framework that you can adjust just for your purpose having your:

  • MODEL: Back End developers using java or another language if they manage to interact with a State Chart library like commons-scxml.
  • VIEW: Front End developers using cool AJAX while reading the xml responses from proper calls they are instructed to make.
  • CONTROLLER: Operation guys/scripters instructed by Business guys about what is the new business rule, the new constraints. They will use just a scripting language like JEXL or even in the future ECMA scripts from the <script> tag already proposed by w3c for the SCXML implementation.

[1] http://en.wikipedia.org/wiki/Business_Process_Execution_Language

[2] http://thinkinginsoftware.blogspot.com/2006/11/scxml-as-controller-language-for-web.html


Posted by: Nestor Urquiza

  • No labels