<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Building Sproutcore Apps with Statecharts (part 1)</title>
	<atom:link href="http://www.itsgotwhatplantscrave.com/2009/02/22/building-sproutcore-apps-with-statecharts-part-1/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.itsgotwhatplantscrave.com/2009/02/22/building-sproutcore-apps-with-statecharts-part-1/</link>
	<description>Sproutcore and other technologies with electrolytes</description>
	<lastBuildDate>Tue, 23 Feb 2010 00:24:19 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Larry Siden</title>
		<link>http://www.itsgotwhatplantscrave.com/2009/02/22/building-sproutcore-apps-with-statecharts-part-1/comment-page-1/#comment-98</link>
		<dc:creator>Larry Siden</dc:creator>
		<pubDate>Thu, 21 Jan 2010 18:59:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.itsgotwhatplantscrave.com/?p=63#comment-98</guid>
		<description>I had the honor of hearing D. Harel talk about state-charts back in the early &#039;80s at our regular symposium when I was a grad-student at the Hebrew U. of Jerusalem.  I was quite impressed even then.  This example w/ login is example what I need for the next stage of my app development and I plan to use it!  Thank you, Erich O.!</description>
		<content:encoded><![CDATA[<p>I had the honor of hearing D. Harel talk about state-charts back in the early &#8217;80s at our regular symposium when I was a grad-student at the Hebrew U. of Jerusalem.  I was quite impressed even then.  This example w/ login is example what I need for the next stage of my app development and I plan to use it!  Thank you, Erich O.!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Evin</title>
		<link>http://www.itsgotwhatplantscrave.com/2009/02/22/building-sproutcore-apps-with-statecharts-part-1/comment-page-1/#comment-97</link>
		<dc:creator>Evin</dc:creator>
		<pubDate>Fri, 15 Jan 2010 18:26:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.itsgotwhatplantscrave.com/?p=63#comment-97</guid>
		<description>@Kristian

If you are going to do a very simple straight forward application it is probably better to use the rootresponders like in /sproutcore/apps/tests/states...

The implementation that I used and wrote about is for most complex applications that need to keep track of parallel states, history states and complex substates.
Looks like you have a good grasp of what is going on in the state charts... it is really hard to understand what to do until you start to actually code an app with a state chart.   The idea is all &#039;actions&#039; take place on the global application namespace.  So in your application if you have a &#039;target&#039; and &#039;action&#039;. ie Buttons, dropdowns etc that trigger events on you app.  Then you are able to sort out based off of where you are on the application (state) to trigger events or processes.

if you would like, I can set up a web meeting to show you some advanced stuff with state charts that we are doing...jsut send me an email.

Evin (etgryphon)</description>
		<content:encoded><![CDATA[<p>@Kristian</p>
<p>If you are going to do a very simple straight forward application it is probably better to use the rootresponders like in /sproutcore/apps/tests/states&#8230;</p>
<p>The implementation that I used and wrote about is for most complex applications that need to keep track of parallel states, history states and complex substates.<br />
Looks like you have a good grasp of what is going on in the state charts&#8230; it is really hard to understand what to do until you start to actually code an app with a state chart.   The idea is all &#8216;actions&#8217; take place on the global application namespace.  So in your application if you have a &#8216;target&#8217; and &#8216;action&#8217;. ie Buttons, dropdowns etc that trigger events on you app.  Then you are able to sort out based off of where you are on the application (state) to trigger events or processes.</p>
<p>if you would like, I can set up a web meeting to show you some advanced stuff with state charts that we are doing&#8230;jsut send me an email.</p>
<p>Evin (etgryphon)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kristian Mandrup</title>
		<link>http://www.itsgotwhatplantscrave.com/2009/02/22/building-sproutcore-apps-with-statecharts-part-1/comment-page-1/#comment-96</link>
		<dc:creator>Kristian Mandrup</dc:creator>
		<pubDate>Fri, 15 Jan 2010 12:49:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.itsgotwhatplantscrave.com/?p=63#comment-96</guid>
		<description>Hi Evin, Nice article! :) But it was pretty hard (even after reading the 2nd part) to understand how to use it in a real life app.

After browsing through the code, this is how I understand it.

main.js
--------
main() {
 // set initial state of application
 ContactsTool.goState(&#039;a&#039;,1);
}

core.js
-------

ContactsTool StateChart object initialized here, contains function for each app. state (as per statechart diagram)

// ContactsTool.goState(&#039;a&#039;,1); becomes a call to state handler function ContactsTool.goStateA1
// the initial login screen is loaded (see login.js)
goStateA1: function() {
 //login screen
 this.set(&#039;mainView&#039;, &#039;ContactsTool.loginPage.mainView&#039;);
}

login.js
--------
Custom page is created with a button. Clicking the button results in the action &#039;submitLogin&#039; on the target ContactsToll (StateChart)
Thus the StatChart will handle this action

Back in core.js
----------------
//core actions

submitLogin: function() {
  var handled = NO;

  switch(this.state.a){
      // if I came from state A1 (initial login screen)   
      case 1:
        // I will go to state A2
        this.goState(&#039;a&#039;,2);
        handled = YES;
        break;
  }
  // error! I shouldn&#039;t end up here. Only valid entry point is from initial login screen!
  if(!handled) console.log(&#039;ContactsTool#submitLogin Action not handled in state %@[%@]&#039;.fmt(&#039;a&#039;,this.state.a));

--
and so on from here... :) 

Any comments?</description>
		<content:encoded><![CDATA[<p>Hi Evin, Nice article! <img src='http://www.itsgotwhatplantscrave.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  But it was pretty hard (even after reading the 2nd part) to understand how to use it in a real life app.</p>
<p>After browsing through the code, this is how I understand it.</p>
<p>main.js<br />
&#8212;&#8212;&#8211;<br />
main() {<br />
 // set initial state of application<br />
 ContactsTool.goState(&#8216;a&#8217;,1);<br />
}</p>
<p>core.js<br />
&#8212;&#8212;-</p>
<p>ContactsTool StateChart object initialized here, contains function for each app. state (as per statechart diagram)</p>
<p>// ContactsTool.goState(&#8216;a&#8217;,1); becomes a call to state handler function ContactsTool.goStateA1<br />
// the initial login screen is loaded (see login.js)<br />
goStateA1: function() {<br />
 //login screen<br />
 this.set(&#8216;mainView&#8217;, &#8216;ContactsTool.loginPage.mainView&#8217;);<br />
}</p>
<p>login.js<br />
&#8212;&#8212;&#8211;<br />
Custom page is created with a button. Clicking the button results in the action &#8216;submitLogin&#8217; on the target ContactsToll (StateChart)<br />
Thus the StatChart will handle this action</p>
<p>Back in core.js<br />
&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
//core actions</p>
<p>submitLogin: function() {<br />
  var handled = NO;</p>
<p>  switch(this.state.a){<br />
      // if I came from state A1 (initial login screen)<br />
      case 1:<br />
        // I will go to state A2<br />
        this.goState(&#8216;a&#8217;,2);<br />
        handled = YES;<br />
        break;<br />
  }<br />
  // error! I shouldn&#8217;t end up here. Only valid entry point is from initial login screen!<br />
  if(!handled) console.log(&#8216;ContactsTool#submitLogin Action not handled in state %@[%@]&#8216;.fmt(&#8216;a&#8217;,this.state.a));</p>
<p>&#8211;<br />
and so on from here&#8230; <img src='http://www.itsgotwhatplantscrave.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
<p>Any comments?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.384 seconds -->
