DominoLite

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:
  • cancelled called when a state transition is cancelled
  • teardown called when the state has changed successfully, but before the entered notification is send for the next state.
    • 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.

    —————————————————————
    the XML:

    
         
       
       
       
       
          
    

    —————————————————————
    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 :)

    Domino rides again

    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.
    Continue reading

    FSMViz Version 0.4

    FSMViz for pureMVC StateMachine Utility

    FSMViz for pureMVC StateMachine Utility


    source code here:
    http://puremvc-utilities.googlecode.com/svn/tags/fsm_viz_0.4

    Added the decode to AS3.

    OK, so next I’m going to rip this all down and re-architecture it.

  • create a shell and a deployment agnostic module
  • split up the encoding/decoding and parsing of the data from the data editing
  • take all the manipulation of the visualisation from the view so that the view just fires notifications
  • make the visualisation into a module so that it can be changed easily
  • add preference data so that properties can be changed easily
  • oh, and implement an FSM :)
  • FSMViz Version 0.3

    FSMViz for pureMVC StateMachine Utility

    FSMViz for pureMVC StateMachine Utility


    source code here:
    http://puremvc-utilities.googlecode.com/svn/tags/fsm_viz_0.3

    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.

    Naming convertions:

  • States will have all white spaces removed and have title case. Thus “Data aquisition” becomes “DataAquisiton”
  • Actions will have white spaces removed and have camel case. Thus “Acquisition failed” becomes “aquisitionFailed”
  • In addition to the above a prefix will be added to further define the name:
  • State names will have the prefix “state/”. Thus “Data aquisition” becomes “state/DataAquisiton”
  • Action names will have the prefix “action/”. Thus “Acquisition failed” becomes “action/aquisitionFailed”
  • Entering notification names will have the same name as their associated state, but with a prefix “entering/”. Thus the entering notification name for the state “Data aquisition” will be “entering/DataAquisiton”
  • Exiting notification names will have the same name as their associated state, but with a prefix “exiting/”. Thus the exiting notification name for the state “Data aquisition” will be “exiting/DataAquisiton”
  • Changed notification names will have the same name as their associated state, but with a prefix “changed/”. Thus the entering notification name for the state “Data aquisition” will be “changed/DataAquisiton”
  • 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!)

    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.

    Domino effect

    Have had a bit more time of my hands at the moment, so I having been spending more time with my son, and have had renewed enthusiasm for my Domino project…

    The new pureMVC StateMachine Utility has enabled my to simplify my ideas again.

    Be assured, I shall be posting my ideas here soon… as long as I don’t bog myself down in detail again.

    Brighton Freelance Flash/Flex Developers

    In the spirit of community, I am posting a list of AS3 developers whom I would personally recommend, should I (obviously top of this list) not be available.

    These are top guys, contact them now!

    Neil Manuell (revision)
    Matt Pearson (zenbullets)
    Matt Sayers (soplausable)
    Owen Bennett (steamboy)
    Rich Willis (rich text format)
    Nikos Chagialas (devGallery)
    Nick Kuh (nick kuh)
    and
    Pedr Brown

    These guys are all members of the award nominated social network of FlashBrighton

    a tiny bit of bitmasking

    Bit masks are good for managing many boolean values within a class. For example, here is a theoretical Alert class, which can show any combination of five buttons: OK, YES, NO, CANCEL, MAYBE. Instead of creating a boolean property for each of these, we can store all this info on one property (in this example the flags property).

    Firstly, for readability, we can map each button type to an uint as an enumerated constant:

    public static const AlertButtons.OK:uint = 1;
    public static const AlertButtons.YES:uint = 2;
    public static const AlertButtons.NO:uint = 4;
    public static const AlertButtons.CANCEL:uint = 8;
    public static const AlertButtons.MAYBE:uint = 16;
    

    then, these constants can be applied to the flags property using the bitwise OR operator ( | ).

    myAlertBox.flags = ( AlertButtons.YES | 
                         AlertButtons.NO | 
                         AlertButtons.MAYBE )
    

    We can then test the flags property against the enumerated value for each button using the bitwise AND operator ( & ).

    if (flags & AlertButtons.OK) trace("OK");
    if (flags & AlertButtons.YES) trace("Yes");
    if (flags & AlertButtons.NO) trace("No");
    if (flags & AlertButtons.CANCEL) trace("Cancel");
    if (flags & AlertButtons.MAYBE) trace("Maybe");