<?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: Simplifying code using states</title>
	<atom:link href="http://www.crazygaze.com/blog/2007/12/19/simplifying-code-using-states/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.crazygaze.com/blog/2007/12/19/simplifying-code-using-states/</link>
	<description>Knowing is not enough; we must apply. Willing is not enough; we must do.</description>
	<lastBuildDate>Sat, 01 Mar 2008 02:00:42 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
	<item>
		<title>By: Rui Figueira</title>
		<link>http://www.crazygaze.com/blog/2007/12/19/simplifying-code-using-states/comment-page-1/#comment-1536</link>
		<dc:creator>Rui Figueira</dc:creator>
		<pubDate>Fri, 11 Jan 2008 13:01:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.crazygaze.com/blog/archives/39#comment-1536</guid>
		<description>You&#039;re right. I often use that approach you talk about, and in my last contract, we extensively used states and events.
But for this particular library, the code needs to be as tight as possible. I constantly need to balance design vs codesize. :(</description>
		<content:encoded><![CDATA[<p>You&#8217;re right. I often use that approach you talk about, and in my last contract, we extensively used states and events.<br />
But for this particular library, the code needs to be as tight as possible. I constantly need to balance design vs codesize. <img src='http://www.crazygaze.com/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rui Martins</title>
		<link>http://www.crazygaze.com/blog/2007/12/19/simplifying-code-using-states/comment-page-1/#comment-1535</link>
		<dc:creator>Rui Martins</dc:creator>
		<pubDate>Fri, 11 Jan 2008 12:40:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.crazygaze.com/blog/archives/39#comment-1535</guid>
		<description>You are on the right track here :)

However, you should give the next Step !

And that is to process State management with a specific function, and stop handling specific states by hand.
In short you need to define a function/method like changeState( new_state ), which will validate everything you need, including, if the request state is a valid transition, from the current state. it Will return success or failure.

This will make it a lot easier to manage, since all state code is contained in one place.

Further ahead, you can also implement event management, where changing state could trigger an event.
Suppose you change state to STOPPED, after validation, the changeState(.. ) function/method could trigger the correct event, that would start an event handler that nows, what is need to stop a specific Audio Sample.
This can be applied to all other states.

Basically, switch from a sequential programming model to an event based model.</description>
		<content:encoded><![CDATA[<p>You are on the right track here <img src='http://www.crazygaze.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>However, you should give the next Step !</p>
<p>And that is to process State management with a specific function, and stop handling specific states by hand.<br />
In short you need to define a function/method like changeState( new_state ), which will validate everything you need, including, if the request state is a valid transition, from the current state. it Will return success or failure.</p>
<p>This will make it a lot easier to manage, since all state code is contained in one place.</p>
<p>Further ahead, you can also implement event management, where changing state could trigger an event.<br />
Suppose you change state to STOPPED, after validation, the changeState(.. ) function/method could trigger the correct event, that would start an event handler that nows, what is need to stop a specific Audio Sample.<br />
This can be applied to all other states.</p>
<p>Basically, switch from a sequential programming model to an event based model.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
