<?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"
	>
<channel>
	<title>Comments on: The ActionScript 3.0 Flyweight Saga: Part I</title>
	<atom:link href="http://www.as3dp.com/2007/06/09/the-actionscript-30-flyweight-saga-part-i/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.as3dp.com/2007/06/09/the-actionscript-30-flyweight-saga-part-i/</link>
	<description>OOP for Flash, Flex and AIR</description>
	<pubDate>Mon, 08 Sep 2008 14:38:57 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
		<item>
		<title>By: Bill Sanders</title>
		<link>http://www.as3dp.com/2007/06/09/the-actionscript-30-flyweight-saga-part-i/#comment-469</link>
		<dc:creator>Bill Sanders</dc:creator>
		<pubDate>Thu, 31 Jan 2008 02:22:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/2007/06/09/the-actionscript-30-flyweight-saga-part-i/#comment-469</guid>
		<description>Hi Jacob,

Thanks for your comments. I was able to get this DP off the ground thanks to Jim Kremens initial rendering, and that's where I first noticed the ..rest parameter. Also, I think that an array was used and I changed it to an associative array (Object) and hung on to the ...rest parameter. Others have mentioned the same thing you did about the use of ...rest. It's not so much that it works; it's that I'm not sure why it lacks that would make it a poor choice. As I keep pounding beyond the FlyWeight, I keep coming back to this same issue, and it is quite helpful to get comments like yours. My problem is that I like going through the agony working to figure out a new DP and since the Mediator is next in line, the little time I have, I spend on getting some ideas for the Mediator. However, after your comments, I'll revisit the FlyWeight again to see about making improvements.

Take care,
Bill</description>
		<content:encoded><![CDATA[<p>Hi Jacob,</p>
<p>Thanks for your comments. I was able to get this DP off the ground thanks to Jim Kremens initial rendering, and that&#8217;s where I first noticed the ..rest parameter. Also, I think that an array was used and I changed it to an associative array (Object) and hung on to the &#8230;rest parameter. Others have mentioned the same thing you did about the use of &#8230;rest. It&#8217;s not so much that it works; it&#8217;s that I&#8217;m not sure why it lacks that would make it a poor choice. As I keep pounding beyond the FlyWeight, I keep coming back to this same issue, and it is quite helpful to get comments like yours. My problem is that I like going through the agony working to figure out a new DP and since the Mediator is next in line, the little time I have, I spend on getting some ideas for the Mediator. However, after your comments, I&#8217;ll revisit the FlyWeight again to see about making improvements.</p>
<p>Take care,<br />
Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jacob Wright</title>
		<link>http://www.as3dp.com/2007/06/09/the-actionscript-30-flyweight-saga-part-i/#comment-466</link>
		<dc:creator>Jacob Wright</dc:creator>
		<pubDate>Wed, 30 Jan 2008 19:35:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/2007/06/09/the-actionscript-30-flyweight-saga-part-i/#comment-466</guid>
		<description>You know Bill, one possibility to explore that might work with Flyweight is drawing API skins. The Flyweight Factory would give back a skin object that would take in color or corner roundness as extrinsic properties in a draw method. Then general properties such as how that skin looked would remain consistent but a few variations would be available depending on the button.

Another note is about using ...rest. You should never use ...rest if you are only accepting a single parameter. In the example you only ever look at rest[0]. I realize it is just that, an example, but proper use and simpler use would have been to give it a default value of null, or rather in this case to leave it out altogether. :)

Now I need to read through your part 2 and 3! Great blog by the way.</description>
		<content:encoded><![CDATA[<p>You know Bill, one possibility to explore that might work with Flyweight is drawing API skins. The Flyweight Factory would give back a skin object that would take in color or corner roundness as extrinsic properties in a draw method. Then general properties such as how that skin looked would remain consistent but a few variations would be available depending on the button.</p>
<p>Another note is about using &#8230;rest. You should never use &#8230;rest if you are only accepting a single parameter. In the example you only ever look at rest[0]. I realize it is just that, an example, but proper use and simpler use would have been to give it a default value of null, or rather in this case to leave it out altogether. <img src='http://www.as3dp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Now I need to read through your part 2 and 3! Great blog by the way.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Sanders</title>
		<link>http://www.as3dp.com/2007/06/09/the-actionscript-30-flyweight-saga-part-i/#comment-29</link>
		<dc:creator>Bill Sanders</dc:creator>
		<pubDate>Sat, 16 Jun 2007 09:03:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/2007/06/09/the-actionscript-30-flyweight-saga-part-i/#comment-29</guid>
		<description>Hi Jim,

I see now. My hunch is that GoF was working with SmallTalk just like we're working with AS 3.0 and so they used it. Likewise, the Freemans (Head First DP authors) were working with Java and decided (correctly it would seem) that a lot of Java programmers would really like a good clear introduction to DPs.

As far as I'm concerned, I think that AS 3.0, even without gems like abstract and private classes, is as good a candidate for DPs as any language. Right now, most of the examples I've found have been written in Java and C#. My hope is that our discussion will bring in more ActionScript programmers and we can all learn from one another like we're trying to do here.

I could do this night and day....and I'll try and get Part 2 (of an unknown number of Parts) done soon. 

Thank you mucho,
Bill</description>
		<content:encoded><![CDATA[<p>Hi Jim,</p>
<p>I see now. My hunch is that GoF was working with SmallTalk just like we&#8217;re working with AS 3.0 and so they used it. Likewise, the Freemans (Head First DP authors) were working with Java and decided (correctly it would seem) that a lot of Java programmers would really like a good clear introduction to DPs.</p>
<p>As far as I&#8217;m concerned, I think that AS 3.0, even without gems like abstract and private classes, is as good a candidate for DPs as any language. Right now, most of the examples I&#8217;ve found have been written in Java and C#. My hope is that our discussion will bring in more ActionScript programmers and we can all learn from one another like we&#8217;re trying to do here.</p>
<p>I could do this night and day&#8230;.and I&#8217;ll try and get Part 2 (of an unknown number of Parts) done soon. </p>
<p>Thank you mucho,<br />
Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jim Kremens</title>
		<link>http://www.as3dp.com/2007/06/09/the-actionscript-30-flyweight-saga-part-i/#comment-28</link>
		<dc:creator>Jim Kremens</dc:creator>
		<pubDate>Sat, 16 Jun 2007 01:58:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/2007/06/09/the-actionscript-30-flyweight-saga-part-i/#comment-28</guid>
		<description>"However, if I said that they were more valuable in SmallTalk, I certainly didn’t mean it!"

No, I just know that a lot of the Gang Of Four patterns are presented in SmallTalk, so I'd be curious to know why (or if) this sort of concept is more viable there.</description>
		<content:encoded><![CDATA[<p>&#8220;However, if I said that they were more valuable in SmallTalk, I certainly didn’t mean it!&#8221;</p>
<p>No, I just know that a lot of the Gang Of Four patterns are presented in SmallTalk, so I&#8217;d be curious to know why (or if) this sort of concept is more viable there.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Sanders</title>
		<link>http://www.as3dp.com/2007/06/09/the-actionscript-30-flyweight-saga-part-i/#comment-27</link>
		<dc:creator>Bill Sanders</dc:creator>
		<pubDate>Sat, 16 Jun 2007 00:03:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/2007/06/09/the-actionscript-30-flyweight-saga-part-i/#comment-27</guid>
		<description>Hi Jim,

I believe you're right. I had chatted with aYo some about it, and he too reached the same conclusion. Also, I arrived at the same conclusion you did. First, I think I'm going to try and tackle the extrinsic state as a parameter in an operation. This will also be abstract, but I'm trying to clarify (for myself as much as for anyone else) the role and use of instrinsic and extrinsic states.

I've spent so much time with the State design pattern that when I think of states, I too often think of it in that context. What I need to do is to get better clarity on how to work with those states as intrinsic and extrinsic and the whole concept of a stateless object.

You mention that you're not clear on why the pattern would be more valuable in some other language. I don't know if it would be. All I know is that it's been difficult to study examples from SmallTalk and Java because often they use examples that include built-in features in those languages that are not in AS 3.0. However, if I said that they were more valuable in SmallTalk, I certainly didn't mean it!

Thanks (yet again!),
Bill</description>
		<content:encoded><![CDATA[<p>Hi Jim,</p>
<p>I believe you&#8217;re right. I had chatted with aYo some about it, and he too reached the same conclusion. Also, I arrived at the same conclusion you did. First, I think I&#8217;m going to try and tackle the extrinsic state as a parameter in an operation. This will also be abstract, but I&#8217;m trying to clarify (for myself as much as for anyone else) the role and use of instrinsic and extrinsic states.</p>
<p>I&#8217;ve spent so much time with the State design pattern that when I think of states, I too often think of it in that context. What I need to do is to get better clarity on how to work with those states as intrinsic and extrinsic and the whole concept of a stateless object.</p>
<p>You mention that you&#8217;re not clear on why the pattern would be more valuable in some other language. I don&#8217;t know if it would be. All I know is that it&#8217;s been difficult to study examples from SmallTalk and Java because often they use examples that include built-in features in those languages that are not in AS 3.0. However, if I said that they were more valuable in SmallTalk, I certainly didn&#8217;t mean it!</p>
<p>Thanks (yet again!),<br />
Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jim Kremens</title>
		<link>http://www.as3dp.com/2007/06/09/the-actionscript-30-flyweight-saga-part-i/#comment-26</link>
		<dc:creator>Jim Kremens</dc:creator>
		<pubDate>Fri, 15 Jun 2007 18:24:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/2007/06/09/the-actionscript-30-flyweight-saga-part-i/#comment-26</guid>
		<description>Hi Bill,

I wrote this Flyweight example a few years ago (in AS2, of course) when I ported eight design patterns to AS in order to learn how they worked.  After I got it working, I didn't think about it too much... Over time, I ended up using lots of the other examples, but never the flyweight.  Now I see why... :-)

If you need to create a bunch of buttons on the stage, all of them need to be unique instances.  You can't put 3 copies of the same button on the stage and then set 3 different x and y values for that button.  Each time you set the x and y values, as you are dealing with only one actual instance, you'll overwrite the last value you set.  They must be discreet instances to have unique property values.

One application I can see of the flyweight is the following: you could use it to configure your button instances.  In other words, you might create one ButtonConfigure object that contains values that you know will remain constant for all of your buttons.  Then, although you still have to create unique button instances, you can use the same configure object to set properties common to all of them.  Properties that need to be unique would be set separately.  This is sort of how stylesheets work...

That might be pretty cool...  You could configure your button class to accept different ButtonConfigure objects.  That would give you a lot of flexibility - the Button class itself could remain really generic - different configure objects would produce very different buttons.

That problem has been solved before, and in most cases without the flyweight.  But if you're looking for an application of this pattern in AS, I think that might be a good one... 

I'm not clear on why this pattern might be more valuable in, say, SmallTalk.  I'd be interested to learn about that...

Jim Kremens</description>
		<content:encoded><![CDATA[<p>Hi Bill,</p>
<p>I wrote this Flyweight example a few years ago (in AS2, of course) when I ported eight design patterns to AS in order to learn how they worked.  After I got it working, I didn&#8217;t think about it too much&#8230; Over time, I ended up using lots of the other examples, but never the flyweight.  Now I see why&#8230; <img src='http://www.as3dp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
If you need to create a bunch of buttons on the stage, all of them need to be unique instances.  You can&#8217;t put 3 copies of the same button on the stage and then set 3 different x and y values for that button.  Each time you set the x and y values, as you are dealing with only one actual instance, you&#8217;ll overwrite the last value you set.  They must be discreet instances to have unique property values.</p>
<p>One application I can see of the flyweight is the following: you could use it to configure your button instances.  In other words, you might create one ButtonConfigure object that contains values that you know will remain constant for all of your buttons.  Then, although you still have to create unique button instances, you can use the same configure object to set properties common to all of them.  Properties that need to be unique would be set separately.  This is sort of how stylesheets work&#8230;</p>
<p>That might be pretty cool&#8230;  You could configure your button class to accept different ButtonConfigure objects.  That would give you a lot of flexibility - the Button class itself could remain really generic - different configure objects would produce very different buttons.</p>
<p>That problem has been solved before, and in most cases without the flyweight.  But if you&#8217;re looking for an application of this pattern in AS, I think that might be a good one&#8230; </p>
<p>I&#8217;m not clear on why this pattern might be more valuable in, say, SmallTalk.  I&#8217;d be interested to learn about that&#8230;</p>
<p>Jim Kremens</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Sanders</title>
		<link>http://www.as3dp.com/2007/06/09/the-actionscript-30-flyweight-saga-part-i/#comment-20</link>
		<dc:creator>Bill Sanders</dc:creator>
		<pubDate>Mon, 11 Jun 2007 12:45:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/2007/06/09/the-actionscript-30-flyweight-saga-part-i/#comment-20</guid>
		<description>aYo,

Thanks for that. I'd really like to see what you develop. My next step is going to be to see how to set up the client to maintain all of the state for all of the virtual button objects. (Actually, I'll have to use "trace" buttons" until I get the structure right.) I'll probably stick with Jim's original Factory structure with the exception that the associative array will be based on an Object class rather than an Array class, and I suspect that the original Client class the Jim made has some important pointers as well.

BTW, I like the ratio of 5:3 in your example. ;O
Bill</description>
		<content:encoded><![CDATA[<p>aYo,</p>
<p>Thanks for that. I&#8217;d really like to see what you develop. My next step is going to be to see how to set up the client to maintain all of the state for all of the virtual button objects. (Actually, I&#8217;ll have to use &#8220;trace&#8221; buttons&#8221; until I get the structure right.) I&#8217;ll probably stick with Jim&#8217;s original Factory structure with the exception that the associative array will be based on an Object class rather than an Array class, and I suspect that the original Client class the Jim made has some important pointers as well.</p>
<p>BTW, I like the ratio of 5:3 in your example. ;O<br />
Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: [a /]</title>
		<link>http://www.as3dp.com/2007/06/09/the-actionscript-30-flyweight-saga-part-i/#comment-19</link>
		<dc:creator>[a /]</dc:creator>
		<pubDate>Mon, 11 Jun 2007 11:30:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/2007/06/09/the-actionscript-30-flyweight-saga-part-i/#comment-19</guid>
		<description>Not a pattern I've ever used so my knowledge is simply from academic curiosity. It seems, (from my understanding of FlyWeight) that the FlyWeight-Factory is intrinsic to its actual deployment. Every version of Flyweight I've seen seems to deploy it in some form or other. I definitely find the theory interesting - Apparently in a situation where multiple instances of a class are needed you create an object based on intrinsic rather than extrinsic values thus reducing the number of created instances. The extrinsic value are passed as an class instance property rather than be created as a unique class

An example would be a school with a population of 5000, 3000 chicks and 2000 dudes. Thus we have 2 class, Dudes and Chicks each possessing the property "population" to which the value can be passed. I'll post my test class/package when I'm done with my muckabouts</description>
		<content:encoded><![CDATA[<p>Not a pattern I&#8217;ve ever used so my knowledge is simply from academic curiosity. It seems, (from my understanding of FlyWeight) that the FlyWeight-Factory is intrinsic to its actual deployment. Every version of Flyweight I&#8217;ve seen seems to deploy it in some form or other. I definitely find the theory interesting - Apparently in a situation where multiple instances of a class are needed you create an object based on intrinsic rather than extrinsic values thus reducing the number of created instances. The extrinsic value are passed as an class instance property rather than be created as a unique class</p>
<p>An example would be a school with a population of 5000, 3000 chicks and 2000 dudes. Thus we have 2 class, Dudes and Chicks each possessing the property &#8220;population&#8221; to which the value can be passed. I&#8217;ll post my test class/package when I&#8217;m done with my muckabouts</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Sanders</title>
		<link>http://www.as3dp.com/2007/06/09/the-actionscript-30-flyweight-saga-part-i/#comment-18</link>
		<dc:creator>Bill Sanders</dc:creator>
		<pubDate>Mon, 11 Jun 2007 10:04:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/2007/06/09/the-actionscript-30-flyweight-saga-part-i/#comment-18</guid>
		<description>Hi again Darren,

I think I have the answer to your question and to a lot to my own. The Factory Method pattern does not inlcude the Client as a participant in its structure. I've been (incorrectly) assuming that the Factory participant in the Flyweight pattern holds the state for all (that's ALL!)of objects (buttons in this case). However, it's the Client that does. So I'm going to have to wrap my head around the Client to figure out how it holds all of the states, while the buttons will be state-free objects...my brain just left on vacation for Acapuco...

Stay tuned,
Bill</description>
		<content:encoded><![CDATA[<p>Hi again Darren,</p>
<p>I think I have the answer to your question and to a lot to my own. The Factory Method pattern does not inlcude the Client as a participant in its structure. I&#8217;ve been (incorrectly) assuming that the Factory participant in the Flyweight pattern holds the state for all (that&#8217;s ALL!)of objects (buttons in this case). However, it&#8217;s the Client that does. So I&#8217;m going to have to wrap my head around the Client to figure out how it holds all of the states, while the buttons will be state-free objects&#8230;my brain just left on vacation for Acapuco&#8230;</p>
<p>Stay tuned,<br />
Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bill</title>
		<link>http://www.as3dp.com/2007/06/09/the-actionscript-30-flyweight-saga-part-i/#comment-17</link>
		<dc:creator>bill</dc:creator>
		<pubDate>Sun, 10 Jun 2007 21:55:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/2007/06/09/the-actionscript-30-flyweight-saga-part-i/#comment-17</guid>
		<description>Hi Darren,

I'm going to talk to Chandima about the Factory Method and the difference between it and the Flyweight. I think I know what Keith meant in reference to a 'Singleton Factory,' but let me see if I can find another way of putting it.

Bill</description>
		<content:encoded><![CDATA[<p>Hi Darren,</p>
<p>I&#8217;m going to talk to Chandima about the Factory Method and the difference between it and the Flyweight. I think I know what Keith meant in reference to a &#8216;Singleton Factory,&#8217; but let me see if I can find another way of putting it.</p>
<p>Bill</p>
]]></content:encoded>
	</item>
</channel>
</rss>
