FSM Visualisation 2

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.

FSM Visualisation

*UPDATED*
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.

I’m using the flare framework and what you see is really just a development from the Dependency Graph.

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″ /]

All Clear

Well, I seem to be all clear of reinfection, and have changed my ftp password.

Let it be known that you should keep your passwords in your head, and not save them. I believe my password was hacked through a security breach in Filezilla, as I saved my profile in the site manager.

If anybody does get a virus/mal-ware alert visiting this site, please tell me.

cheers

Warning

I’m still having problems with html/framer, an keep on being reinfected from some where. If anyone knows how to get rid of this, I would be grateful. So I have reinstalled a clean version word press, and a few images, but I have not uploaded any of my swf content. I’m going to see if that makes any difference. Apologies again.

Domino: the Concept

I’ve been attempting to build a real world application using Domino, just to see how it works. The example is a FlickBook application, and Domino is proving quite easy to use, and is doing what I originally intended, which was to help me organise and visualise my commands better.

I’m not going to show any demos or code here, but I thought I’d explain the concept. To tell the truth I’m not sure if this is just an interesting experiment, or has any serious value, so I would like your opinion.

Some Definitions

Link: represents an instance of a command which may have some metadata injected into it.

Chain: a list of links, executed top down. A chain can be public (invokable from the main framework) or private (accessible only from inside domino).

ChainSet: a collection of chains that declares a list of states in which the member chains are active.

Link Types

[kml_flashembed movie=”http://www.revisual.co.uk/uploads/2009/jan/domino/domino_key.swf” height=”255″ width=”470″ /]

Synch/AsynchProcessLink:
overrides a method with the signiture:

protected function process ( notification:INotification ): void

Changes something within with pureMVC frame work, and/or the incoming notification. Once completed, the next link in the chain is executed.

EvaluationLink
overrides a method with the signiture:

protected function evaluate( notification:INotification ): Boolean

Tests a condition within the pureMVC framework and/or incoming notification, and returns a Boolean value.
false: the next link in the chain is executed.
true: the execution thread is redirected to the link indicated in its metadata. This can be any link in the current chain, or the first link in a different chain (see also ReturnLink).

GosubLink
overrides a method with the signiture:

protected function prepare( notification:INotification ): void

The execution thread is redirected to the chain indicated in its metadata. The prepare method hook allows the outgoing notification to be changed before redirection (see also ReturnLink and Notification Scope).

ReturnLink
final class:
Returns the thread back to its referring chain.

TerminationLink
final class:
Ends the process and notifies the rest of the pureMVC framework.

Notification Scope
Each Chain maintains its own notification. If the thread is redirected to another chain via an EvaluationLink or a GosubLink, then the original notification is restored if and when it is returned to that chain.

Consider this diagram:
[kml_flashembed movie=”http://www.revisual.co.uk/uploads/2009/jan/domino/domino_diagram.swf” height=”775″ width=”470″ /]
We have three ChainSets, one active in the “init” state, another active in the “exit” state, and the third active in both.
The initiation and exit ChainSets have public chains that are invoked on entry into their declared states. The “utils” set’s chains are all private, thus can be accessed only by referral from another active chain.

1) The Init State is entered, and the chain EnterInitState is invoked:

  • CreateActorList (a GosubLink) is executed. This retrieves an Array of class paths from the ConfigurationProxy, adds it to its notification and redirects the thread to the createActor chain (see 2).
  • when the thread returns to the chain, the TerminationLink is executed which ends the process, and sends a TERMINATION notification to the rest of the framework
  • 2) The createActor chain recieves an Array as the notification body:

  • its first link ShiftArray (a GosubLink), shifts an element off the Array, and redirects it (see 3)
  • the second element ArrayLenZero (an EvaluateLink) checks the length of the Array, if it is > 0 it loops back to ShiftArray, otherwise it continues to
  • the final ReturnLink, which returns the thread back to its referring chain
  • 3) the createNotifier chain receives a class path (String) as its notification body

  • the CreateNotifier link (a SynchProcessLink) creates a class instance from the class path, and adds it to the notification body
  • then the RegisterNotifier link (a SynchProcessLink) checks the notification body type, and registers it with the facade accordingly
  • the final ReturnLink returns the thread back to its referring chain
  • The overall effect is to create and register all the application’s Mediators and Proxies from a list in the config when the application enters its init state.

    I think thats all fairly simple to understand… I’ve thought very much along the lines of Chain of Responsibility. If an element does not know how to deal with something, it passes it on. I also have an error handling system prepared and implemented, but not yet tested.

    Should I proceed, the next step is to take the XML and create a tool that visualises it (like the diagrams above which were, alas, laid out by hand).

    I’d love to know what people think:
    An interesting experiment or something with real-world value.

    cheers.

    the xml this visualises is here

    Asynch StateMachine Demo 2

    Using the AsyncCommand util (pureMVC)
    I wanted to see how the AsynchCommand would work with the synchronous nature of the StateMachine, and whether the AsynchMacroCommand would hold the thread until its completion. Unfortunately in this example it seems that it doesn’t: the DISPLAY state is entered before the asynchrous loading process ends. This is safe in this demo as the progress window is modal and inhibits interaction, but this could open windows of uncertainty.

    State Diagram:
    [kml_flashembed movie=”http://www.revisual.co.uk/uploads/2009/jan/asynchStateDemo2/state_diagram2.swf” height=”180″ width=”300″ /]

    In this demo, there are only two states. The loading takes place when entering the DISPLAY state.

    Demo App:
    [kml_flashembed movie=”http://www.revisual.co.uk/uploads/2009/jan/asynchStateDemo2/asynchStateDemo2.swf” height=”300″ width=”470″ /]

    Asynch StateMachine Demo

    I’ve whipped up a quick demo for the pureMVC StateMachine utility, illustrating the encapsulation of an asynchronous process (loading external images) within a state.

    State Diagram:
    [kml_flashembed movie=”http://www.revisual.co.uk/uploads/2009/jan/asynchStateDemo/state_diagram.swf” height=”180″ width=”300″ /]
    The red LOADING state represents the non-interactive state, were the laoding takes place. The state is left when all the images are loaded (to DISPLAY), or an error occurs (to READY).

    Demo App:
    [kml_flashembed movie=”http://www.revisual.co.uk/uploads/2009/jan/asynchStateDemo/asynchStateDemo.swf” height=”300″ width=”470″ /]

    Yeehaa!

    Well, I’ve got the Domino core classes working on some simple test examples (without any error handling classes).

    I want to create a more real world example before I show anything, and in the mean time, I’ll write down a few notes on how it all works.