OK, so after some discussion with Nils Millahn I have cut down the functionality for my first release of Domino.
Domino will build and inject the StateMachine and add these additional functionalities:
- 1) the ability to define custom States in the XML markup
- 2) two additional notifications:
- 3) the ability to declare a command in the XML to be executed at each stage of the state transition cycle.
- 4) the ability to declare state specific notifications in the XML to be send at each stage of the state transition cycle.
So at the moment I’ve given it to a few people to have a look at it to give feedback, and when I’m happy will upload it to my google.code site.
Oh and please feel free to leave your own suggestions :)
Strange how things come full circle.
Last year I was trying to manage the flow of pureMVC commands in my applications. Two things came out of this, the StateMachine utility, and an idea that I christened Domino. Well, Domino went a bit strange on me, and eventually I let it fallow for a bit while I worked on the FSMVisualiser.
I’ve been manically working on several projects this year, and as I was commenting a utility that had been evolving throughout this time, I realised that with a tweek here and there I could create a layer of abstraction over the StateMachine utility in a simple and (I hope) elegant way. It would fulfill the original purpose of Domino without getting really complicated in the process. Basically it extends the StateMachine markup XML so that it also defines the relationships between pureMVC actors within each state.
This month I’ve been able to do a bit more work on the FSMVisualiser, and am incorporating my Domino utility into it as a proof of concept.
source code here:
Added the decode to AS3.
OK, so next I’m going to rip this all down and re-architecture it.
source code here:
OK, so I’ve added the ability to open from JSON or XML and also to decode to them. Originally, I was just going to save out to JSON as the main “file-type”, and export to an AS3 file, but after Jason MacDonald suggested it would be good to export/import the xml, I thought why not, it only took an hour.
The only things to note are that the XML looses all the meta data that the JSON preserves. And secondly, because of this, it can only import XML that uses the naming conversions outlined below.
I think that these are pretty uncontentious with the exception of the choice of delimiter for the prefix. This I think will be changable by the user.
All I have to do now is that all important conversion to an AS3 file, then I can rip the whole thing apart and rebuild it.
So, any suggestions as to deployment? Air, online with php service?, Zinc? (Zinc? LOL only joking!)
source code here:
So this is just the visualisation and the editing of the States and Actions. I still need to implement the saving out of state, and the export of the StateConstants.as
A few points and pointers:
Sorry I’ve been neglecting my blog recently. What with a brute force attack of malware, and working on some bread-and-butter projects, I’ve been a bit diverted.
However, I have found the time to play around with the FSM Visualiser and have been working on the best way to display and interact with it, so I’ll probably stick something fresh up with in the next week or so.
just put the FSMViz project on my google code page.
To grab from the svn use:
UPDATE: removed this demo due to it getting infected. Will upload a newer version once I have time to work on something
I have added some more functionality to the FSMViualisation.
Just a few notes:
1) I haven’t been able to add labels to the actions (arrows) yet (well, not prettily anyhow).
2) I have used the BundledEdgeRouter which makes those nice arrows. The problem with this is that any arrow that connects the same two nodes will lie on the same line.
3) at the moment, to update the diagram, I am having to edit my VOs, parse them into a Flare Data object, then construct a new Visualisation with it. It seems a bit expensive (not that affects the speed at all).
4) you can add States into a package. This does not affect any of the code that will eventually be exported, but does allow you to group the state together, and makes the diagram look far more appealing.
OK, have put together the first visualisation for a pureMVC StateMachine Utility markup tool.
The purposes of this tool are:
1) to make a state diagram for easier visualisation of the flow of your application
2) to create the FSMInjector class for your application, along with all the necessary constants, and the XML declaration.
The visualisation data is stored as a text file in JSON, along with all the metadata associated with each node and edge. This will be the file format for saving and retrieving work. There will also eventually be an export routine that will convert this format into the FSMInjector.
At the moment we just have the ability to visualise, not to edit. The next pieces of functionality I will be working on will be:
1) adding states.
2) deleting states.
3) adding edges (actions).
4) deleting edges.
[kml_flashembed movie=”http://www.revisual.co.uk/uploads/2009/may/fsm/demo1/demo1.swf” height=”400″ width=”470″ /]