Commons SCXML
  1. Commons SCXML
  2. SCXML-196

Redefine SCXMLSemantics to align with the Algorithm for SCXML Interpretation as described in the SCXML specification

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Labels:
      None

      Description

      One of the targets for the Commons SCXM 2.0 roadmap milestone 1 is to redefine SCXMLSemantics to align with the SCXML Algorithm for SCXML Interpretation, see: http://www.w3.org/TR/scxml/#AlgorithmforSCXMLInterpretation
      The current SCXMLSemantics interface and its implementation is so much different from the algorithm in the specification that 'molding' it into what the algorithm now expects is too cumbersome.

      The current SCXMLSemantics and its implementation will therefore be completely replaced with a new one, closely corresponding to the semantics of the SCXML Algorithm in the specification.

      The algorithm described in the specification leaves plenty of room for optimization and choice of techniques.
      For a first cut implementation though I intend to simply follow the described algorithm as close as possible, also to make sure not to deviate from the specification already too early
      After the new implementation has been tested and validated to be conforming the expected behavior, or even later than that, the implementation surely can be refined and optimized further.

      The changes needed for this task are closely related to those described in SCXML-197: Better separation of concern between SCXMLExecutor and SCInstance and introducing a new SCXMLExecutionContext.
      Although through SCXML-197 already many improvements are realized, to be able to implement the new SCXMLSemantics requires additional (major) changes, which functionally should be regarded part of SCXML-197, but cannot be committed separately as the changes are too closely related.
      I'll therefore update SCXML-197 describing those functional changes regarding the better separation of concerns, although they will be committed against this issue.

      An important note is that with the re-implementation of the SCXMLSemantics, the static SCXMLHelper class, as well as the (Transition) Path helper class functionalities will be completely 'absorbed' into the model and the new algorithm implementation. These classes therefore no longer are used and needed and will be removed.
      Furthermore, the Step class now only is used from within the SCXMLSemantics implementation and therefore moved to the semantics package.

      With these changes in SCXML-196 and SCXML-197, the goals for Milestone 1 on the roadmap to SCXML 2.0 have been completely met and I'll create a milestone 1 svn tag for it shortly.

        Activity

        Ate Douma created issue -
        Ate Douma made changes -
        Field Original Value New Value
        Status Open [ 1 ] In Progress [ 3 ]
        Ate Douma made changes -
        Comment [ Ugh, above initial plan already starts breaking down :(
        Keeping the existing implementation (SCXMLExecutor and SCXMSemanticsImpl) working while starting refactoring the initialScript (to be renamed to globalScript) handling is already too much complicated and invasive for the existing implementation to be reasonable to retain both implementations side-by-side.

        So, I will drop this plan as well as the new SCXMLExecutor2 and SCXMLSemanticsImpl2 classes, and instead start hacking directly on the existing implementation.
        This means it will be impossible, within the same codebase, to check and compare the old against the new semantics, but so be it.
        The milestone 0 tag at least is available to code compare against, and the current, and for sure needed additional, unit tests to validate against.
         This also means the current trunk will undergo a lot more immediately changes as of now! ]
        Ate Douma made changes -
        Description One of the targets for the Commons SCXM 2.0 roadmap milestone 1 is to redefine SCXMLSemantics to align with the SCXML Algorithm for SCXML Interpretation, see: http://www.w3.org/TR/scxml/#AlgorithmforSCXMLInterpretation
        The current SCXMLSemantics interface and its implementation is so much different from the algorithm in the specification that 'molding' it into what the algorithm now expects is too cumbersome.

        The high-level plan I have is to:
        - fork SCXMLSemanticsImpl to SCXMLSemanticsImpl2, without implementing SCXMLSemantics
        - fork SCXMLExecutor to SCXMLExecutor2, extending SCXMLExecutor
        - switch to use SCXMLSemanticsImpl2 explicitly in SCXMLExecutor2
        - start with simply implementing the SCXML Algorithm from 'scratch' in SCXMLSemanticsImpl2 using (top level) methods matching those described in the algorithm and refactor SCXMLExecutor2 to leverage this

        With the above initial steps, the existing implementation will stay in place and remains available to compare and test the new implementation against.
        There probably will be need to make accommodating changes in other areas, which I will try to keep compatible with the existing implementation or at least not to break it.
        The reason to fork and extend SCXMLExecutor is that it is referenced and used in many other places (that is: currently), like in SCInstance. By extending it, the SCXMLExecutor2 can still play that role without directly breaking everything.

        The algorithm described in the specification leaves plenty of room for optimization and choice of techniques.
        For a first cut implementation though I intend to simply follow the described algorithm as close as possible, also to make sure not to deviate from the specification already too early :)
        After the new implementation has been tested and validated to be comforming the expected behavior, or even later than that, the implementation surely can be refined and optimized further.
        That also will be time to decide to drop and replace the existing SCXMLExecutor and SCXMLSemantics (both interface and implementation) with the new versions.
        One of the targets for the Commons SCXM 2.0 roadmap milestone 1 is to redefine SCXMLSemantics to align with the SCXML Algorithm for SCXML Interpretation, see: http://www.w3.org/TR/scxml/#AlgorithmforSCXMLInterpretation
        The current SCXMLSemantics interface and its implementation is so much different from the algorithm in the specification that 'molding' it into what the algorithm now expects is too cumbersome.

        The current SCXMLSemantics and its implementation will therefore be completely replaced with a new one, closely corresponding to the semantics of the SCXML Algorithm in the specification.

        The algorithm described in the specification leaves plenty of room for optimization and choice of techniques.
        For a first cut implementation though I intend to simply follow the described algorithm as close as possible, also to make sure not to deviate from the specification already too early :)
        After the new implementation has been tested and validated to be conforming the expected behavior, or even later than that, the implementation surely can be refined and optimized further.

        The changes needed for this task are closely related to those described in SCXML-197: Better separation of concern between SCXMLExecutor and SCInstance and introducing a new SCXMLExecutionContext.
        Although through SCXML-197 already many improvements are realized, to be able to implement the new SCXMLSemantics requires additional (major) changes, which functionally should be regarded part of SCXML-197, but cannot be committed separately as the changes are too closely related.
        I'll therefore update SCXML-197 describing those functional changes regarding the better separation of concerns, although they will be committed against this issue.

        An important note is that with the re-implementation of the SCXMLSemantics, the static SCXMLHelper class, as well as the (Transition) Path helper class functionalities will be completely 'absorbed' into the model and the new algorithm implementation. These classes therefore no longer are used and needed and will be removed.
        Furthermore, the Step class now only is used from within the SCXMLSemantics implementation and therefore moved to the semantics package.

        With these changes in SCXML-196 and SCXML-197, the goals for Milestone 1 on the roadmap to SCXML 2.0 have been completely met and I'll create a milestone 1 svn tag for it shortly.
        Ate Douma made changes -
        Comment [ The new definition and implementation of the SCXMLSemantics by SCXML-196 also automatically resulted in some further separation of concerns for the SCXMLExecutor, SCInstance and SCXMLExecutionContext, which 'fitted well' with the goals for this issue.
        While those changes have been committed against SCXML-196, I'm describing the high-level changes here.

        The SCXMLExecutor now is completely 'detached' from both SCInstance and SCXMLExecutionContext, and only holds a reference to the SCXMLSemantics and SCXMLExecutionContext itself.

        Functionally, the SCXMLExecutor now is reduced to be only a 'driver' providing the public (user) interface for executing SCXML based state machines, and receiving events to do so.

        Behind this public executor facade, the SCXMLExecutionContext now manages everything except the external event queue and driving the SCXMLSemantics.
        The state machine processing through the SCXMLSemantics is driven by the SCXMLExecutor providing it the SCXMLExecutionContext as input.

        The SCInstance now hold all and only the state machine persistable state, and can be 'detached' and 're-attached' in the SCXMLExecutionContext (serviced through the SCXMLExecutor).

        The default SCXMLSemantics implementation is fully stateless and invoked from the SCXMLExecutor through only three main entry points: firstStep, nextStep and finalStep, taking the SCXMLExecutionContext as parameter.

        With these changes in SCXML-196 and SCXML-197, the goals for Milestone 1 on the roadmap to SCXML 2.0 have been completely met and I'll create a milestone 1 svn tag for it shortly.
        ]
        Ate Douma made changes -
        Status In Progress [ 3 ] Open [ 1 ]
        Ate Douma made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open In Progress In Progress
        14m 24s 1 Ate Douma 13/Mar/14 22:12
        In Progress In Progress Open Open
        20d 9h 6m 1 Ate Douma 03/Apr/14 08:18
        Open Open Resolved Resolved
        27s 1 Ate Douma 03/Apr/14 08:19

          People

          • Assignee:
            Ate Douma
            Reporter:
            Ate Douma
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development