[ 
https://issues.apache.org/jira/browse/SCXML-47?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12506990
 ] 

Rahul Akolkar commented on SCXML-47:
------------------------------------

Looks good, a few minutiae:

 * Perhaps it is better to have the name elaborate that the support is for 
authoring classes that model stateful entities (and the operations performed in 
those states). Do you think the name ClassStateMachineSupport makes more sense? 
It does to me, but I'm not very good with names.
 * The StateMachineSupport class (new name TBD) needs a ton of Javadoc at the 
class level so folks can get a hang of whats in there (thanks for the new 
method Javadocs). Some of your usage code snippets in the opening description 
of this issue would also help a lot as part of that Javadoc.
 * Code has unused imports (and some other warnings from my IDE about unused 
stuff that are probably bogus)
 * We should have only one AbstractStateMachine class (the current one can 
extend StateMachineSupport and we'll be done with that). I don't see what we 
can do about your constructors being a bit messy comment (I think we'll leave 
them the way you have them).

Do you want to make these changes? I can too, but I can't say when.


> Provide a state machine support class to allow for delegation.
> --------------------------------------------------------------
>
>                 Key: SCXML-47
>                 URL: https://issues.apache.org/jira/browse/SCXML-47
>             Project: Commons SCXML
>          Issue Type: Improvement
>    Affects Versions: 0.6
>            Reporter: Michael Heuer
>            Priority: Minor
>             Fix For: 0.7
>
>         Attachments: state-machine-support-src.tar.gz
>
>
> This is not completely thought out yet, but if folks like the idea I might 
> persue it further.
> I would like to use AbstractStateMachine but cannot extend from it:
> class B extends A /*, AbstractStateMachine */ {
>   // copy source from AbstractStateMachine here
> }
> I propose here a StateMachineSupport class that provides for use by 
> subclassing and for use by delegation.  The constructors are a little messy, 
> but in the end I have
> public class StateMachineSupport {
>   // use by subclassing
>   protected StateMachineSupport(...) {
>   }
>   // use by delegation
>   public StateMachineSupport(Object delegator, ...) {
>   }
>   // ... methods from AbstractStateMachine
> }
> public abstract class AbstractStateMachine extends StateMachineSupport {
>   protected AbstractStateMachine(...) {
>     super(...);
>   }
> }
> // use by subclassing
> class ConcreteStateMachine extends AbstractStateMachine {
>   ConcreteStateMachine() {
>     super(..."stopwatch.xml");
>   }
>   public void reset() { ... }
>   public void running() { ... }
>   public void paused() { ... }
>   public void stopped() { ... }
> }
> // use by delegation
> class DelegatingStateMachine extends SomethingElse {
>   StateMachineSupport delegate;
>   DelegatingStateMachine() {
>     delegate = new StateMachineSupport(this, ..."stopwatch.xml");
>   }
>   public void reset() { ... }
>   public void running() { ... }
>   public void paused() { ... }
>   public void stopped() { ... }
> }
> StateMachineSupport.java, AbstractStateMachine2.java, 
> StateMachineSupportTest.java, and AbstractStateMachine2Test.java attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to