atom feed8 messages in com.googlegroups.sproutcore[sproutcore] Re: Announcing Ki: A Sta...
FromSent OnAttachments
Michael CohenSep 7, 2010 9:06 am 
Jonathan LewisSep 7, 2010 8:32 pm 
Peter WagenetSep 7, 2010 10:41 pm 
Michael CohenSep 8, 2010 8:10 am 
Charles JolleySep 8, 2010 4:02 pm 
Michael CohenSep 8, 2010 5:33 pm 
ColinSep 9, 2010 1:17 pm 
Michael CohenSep 9, 2010 8:39 pm 
Subject:[sproutcore] Re: Announcing Ki: A Statechart Framework for SproutCore
From:Michael Cohen (mich@gmail.com)
Date:Sep 8, 2010 8:10:12 am
List:com.googlegroups.sproutcore

Being able to focus efforts all in one place is certainly a positive. Seeing a statechart framework already in SproutCore and an external statechart framework like Ki may confuse people about what solution to go with, especially those newer to SproutCore. Perhaps I can shed some more light on Ki and the statechart framework that currently comes with SproutCore.

The statechart framework that comes with SproutCore certainly allows for state hierarchies and grouping of states within states. In addition, the framework also supports top-level state concurrency (state independence). These concepts are part of what you see in David Harel's statechart paper. And, of course, you are able to send events to the statechart that all of its current states can react to. That being said, there are some limitations.

A primary limitation is that you can't nest concurrent states within states in a statechart. This may not sound like much, but it becomes immediately apparent for large applications that have many features or modules, each that may require their own concurrent states. In order to get around this limitation you have to create new statecharts to represent nested concurrent states. Also, since those statecharts are separate entities, events sent to the main statechart are not implicitly propagated to other statecharts. You essentially have to make your own code to pass events along, which leads to inconsistent and extra code to maintain in addition to being error prone. Then there is the matter of just how enter and exit all those sub concurrent states -- Eek.

Apart from not being able to nest concurrent states within states, the statechart framewok in SproutCore also does not support the ability to perform asynchronous actions during a state transition process (going from one state to another state), meaning you can't do things like animations when entering and exiting states. The framework also requires that all states that are part of the statechart must have unique names, which can be cumbersome to keep track of when you have a large number of states in your statechart. Finally, the framework also limits your ability to reuse states (refered to as overlapping states in Harel's paper).

Ki was built up in order to address each of the these limitations and provide one simple, cohesive solution. But again, I did begin with the intent of trying to rework and update SproutCore's current statechart framework; however, given the differences and the way Ki needed to be implemented, it just turned out to be easier to start with a clean slate.

Mike

On Sep 8, 1:41 am, Peter Wagenet <pete@gmail.com> wrote:

Looks like we now have a few different statechart options. I wonder if it's
getting time to evaluate the options and have an officially approved solution. It would be nice to focus the effort all
in one place.

On Sep 7, 2010, at 8:33 PM, Jonathan Lewis wrote:

That's great, Mike -- Looking forward to getting a look at this.

On Sep 7, 2010, at 12:06 PM, Michael Cohen wrote:

Hey all,

Just wanted to announce that I've completed the first beta release of Ki version 0.1.0. Ki is a statechart framework for SproutCore that closely follows what is described in David Harel's original paper "Statecharts: A Visual Formalism For Complex Systems". The framework is open source and is under the MIT license. You can get Ki from the following:

I originally started off by trying to refactor and extend the statechart framework that already comes with the latest SproutCore on github, but I quickly realized that is was far easier just to start from scratch in order to create a holistic solution that incorporates all the new features. That being said, there are parts of Ki that were derived from the current SproutCore statechart framework.

Mike