<?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: Do I use Array or Arraycollection?</title>
	<atom:link href="http://www.unitedmindset.com/jonbcampos/2009/04/03/do-i-use-array-or-arraycollection/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.unitedmindset.com/jonbcampos/2009/04/03/do-i-use-array-or-arraycollection/</link>
	<description>Blog on technology and software development typically around Adobe Flash, Flex, and AIR.</description>
	<lastBuildDate>Wed, 25 Jan 2012 11:21:07 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: ioan</title>
		<link>http://www.unitedmindset.com/jonbcampos/2009/04/03/do-i-use-array-or-arraycollection/#comment-1052</link>
		<dc:creator>ioan</dc:creator>
		<pubDate>Tue, 22 Mar 2011 09:27:40 +0000</pubDate>
		<guid isPermaLink="false">http://unitedmindset.com/jonbcampos/?p=258#comment-1052</guid>
		<description>Cool! Thx for the article. It really helps... :)</description>
		<content:encoded><![CDATA[<p>Cool! Thx for the article. It really helps&#8230; <img src='http://www.unitedmindset.com/jonbcampos/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeffry Houser</title>
		<link>http://www.unitedmindset.com/jonbcampos/2009/04/03/do-i-use-array-or-arraycollection/#comment-65</link>
		<dc:creator>Jeffry Houser</dc:creator>
		<pubDate>Tue, 20 Jul 2010 11:55:20 +0000</pubDate>
		<guid isPermaLink="false">http://unitedmindset.com/jonbcampos/?p=258#comment-65</guid>
		<description>Jonathon,

For some reason I thought that Array.sort only worked for simple values, not objects.  But reviewing the ASDocs it appears that is not the case.  You can easily specify a compareFunction which should handle complex objects.

You&#039;re right, I bet it would handle most cases.</description>
		<content:encoded><![CDATA[<p>Jonathon,</p>
<p>For some reason I thought that Array.sort only worked for simple values, not objects.  But reviewing the ASDocs it appears that is not the case.  You can easily specify a compareFunction which should handle complex objects.</p>
<p>You&#8217;re right, I bet it would handle most cases.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Campos</title>
		<link>http://www.unitedmindset.com/jonbcampos/2009/04/03/do-i-use-array-or-arraycollection/#comment-64</link>
		<dc:creator>Jonathan Campos</dc:creator>
		<pubDate>Tue, 20 Jul 2010 00:21:13 +0000</pubDate>
		<guid isPermaLink="false">http://unitedmindset.com/jonbcampos/?p=258#comment-64</guid>
		<description>Well, I guess the question is how complicated is the sorting? For something really simple you could just use the built in Array.sort() function. I bet that would handle most cases.

For something really complicated then yes, I would probably create some sort of utility to change the Array. Unless I am dealing with this being on the view, where we both agree we&#039;d go with an ArrayCollection</description>
		<content:encoded><![CDATA[<p>Well, I guess the question is how complicated is the sorting? For something really simple you could just use the built in Array.sort() function. I bet that would handle most cases.</p>
<p>For something really complicated then yes, I would probably create some sort of utility to change the Array. Unless I am dealing with this being on the view, where we both agree we&#8217;d go with an ArrayCollection</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeffry Houser</title>
		<link>http://www.unitedmindset.com/jonbcampos/2009/04/03/do-i-use-array-or-arraycollection/#comment-63</link>
		<dc:creator>Jeffry Houser</dc:creator>
		<pubDate>Tue, 20 Jul 2010 00:05:16 +0000</pubDate>
		<guid isPermaLink="false">http://unitedmindset.com/jonbcampos/?p=258#comment-63</guid>
		<description>&quot;I agree also that you get sorting and filtering is in a collection, but I don’t think that you should use an ArrayCollection just to sort an array&quot;

What would you do instead?  Write your own quicksort algorithm?</description>
		<content:encoded><![CDATA[<p>&#8220;I agree also that you get sorting and filtering is in a collection, but I don’t think that you should use an ArrayCollection just to sort an array&#8221;</p>
<p>What would you do instead?  Write your own quicksort algorithm?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Campos</title>
		<link>http://www.unitedmindset.com/jonbcampos/2009/04/03/do-i-use-array-or-arraycollection/#comment-62</link>
		<dc:creator>Jonathan Campos</dc:creator>
		<pubDate>Mon, 19 Jul 2010 20:04:42 +0000</pubDate>
		<guid isPermaLink="false">http://unitedmindset.com/jonbcampos/?p=258#comment-62</guid>
		<description>@Jeffry, I completely agree that for many of these points I oversimplified the answer.

For the quote at the top, it was meant to be an exaggeration as to how many early developers see Arrays vs ArrayCollection. Not that it is correct or even close to the entire story.

I agree that Arrays can be used as a point for data binding. The Flex compiler adds many arguments to the original array to be able to listen for changes from the array. Heck, in most components when you pass an Array in, the Array gets wrapped in an ArrayCollection so that the data binding can be used.

I agree also that you get sorting and filtering is in a collection, but I don&#039;t think that you should use an ArrayCollection just to sort an array - yes I&#039;ve seen this practice. Sorting and filtering can be something that is quickly done on the data model with a small function. Obviously the time to worry about these specific points is when you are really getting into performance tuning.

You&#039;re right that I used the wrong words in the last example. The sorting is on the collection, but the two views are tied together using the sorting information. If you were to sort the actual Array source it would not be reflected back up the collection as the collection has it&#039;s own virtual &quot;view&quot; of the data. However, if you were to filter or extract data from the original source Array, that will effect the final collection that is shared between views.

Again, sorry for an over simplification but I&#039;m glad to see people pushing back and wanting to make sure the correct information is being shown.</description>
		<content:encoded><![CDATA[<p>@Jeffry, I completely agree that for many of these points I oversimplified the answer.</p>
<p>For the quote at the top, it was meant to be an exaggeration as to how many early developers see Arrays vs ArrayCollection. Not that it is correct or even close to the entire story.</p>
<p>I agree that Arrays can be used as a point for data binding. The Flex compiler adds many arguments to the original array to be able to listen for changes from the array. Heck, in most components when you pass an Array in, the Array gets wrapped in an ArrayCollection so that the data binding can be used.</p>
<p>I agree also that you get sorting and filtering is in a collection, but I don&#8217;t think that you should use an ArrayCollection just to sort an array &#8211; yes I&#8217;ve seen this practice. Sorting and filtering can be something that is quickly done on the data model with a small function. Obviously the time to worry about these specific points is when you are really getting into performance tuning.</p>
<p>You&#8217;re right that I used the wrong words in the last example. The sorting is on the collection, but the two views are tied together using the sorting information. If you were to sort the actual Array source it would not be reflected back up the collection as the collection has it&#8217;s own virtual &#8220;view&#8221; of the data. However, if you were to filter or extract data from the original source Array, that will effect the final collection that is shared between views.</p>
<p>Again, sorry for an over simplification but I&#8217;m glad to see people pushing back and wanting to make sure the correct information is being shown.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeffry Houser</title>
		<link>http://www.unitedmindset.com/jonbcampos/2009/04/03/do-i-use-array-or-arraycollection/#comment-61</link>
		<dc:creator>Jeffry Houser</dc:creator>
		<pubDate>Mon, 19 Jul 2010 19:42:48 +0000</pubDate>
		<guid isPermaLink="false">http://unitedmindset.com/jonbcampos/?p=258#comment-61</guid>
		<description>I just came across this when you linked to it from StackOverflow.  I have a few thoughts I&#039;d thought I&#039;d share.

You said:
&quot;[A collection is] like an Array PLUS it has binding &quot;

There is no reason why Array&#039;s can&#039;t be used as the source for data binding.  See the dayNames property of the DateChooser as one example.


You said:
Collections do have a collectionChange event, which list based classes will listen for and update display based on those changes.  But, that isn&#039;t the same as binding.

&quot;There is nothing built into an ArrayCollection that isn’t already part of the Array.&quot;

This is incomplete at best, wrong at worse.  The sorting and filtering functionality of a Collection class are things you do not get with a simple Array.  I have used the sorting functionality independent of any view components.  The dayRenderers of the Flextras Calendar are sorted in order of their date before the collection is looped over and days are placed on the display.

You also say &quot;sorting information is shared between Collections&quot;.

This is a bit misleading.  The example you use is that a collection is shared between two views.  It is true that if you sort the collection the changes will be reflected in both views.  But, sorting is never shared between two separate collections.

Although, I do agree that Collections are best suited for use in views.</description>
		<content:encoded><![CDATA[<p>I just came across this when you linked to it from StackOverflow.  I have a few thoughts I&#8217;d thought I&#8217;d share.</p>
<p>You said:<br />
&#8220;[A collection is] like an Array PLUS it has binding &#8221;</p>
<p>There is no reason why Array&#8217;s can&#8217;t be used as the source for data binding.  See the dayNames property of the DateChooser as one example.</p>
<p>You said:<br />
Collections do have a collectionChange event, which list based classes will listen for and update display based on those changes.  But, that isn&#8217;t the same as binding.</p>
<p>&#8220;There is nothing built into an ArrayCollection that isn’t already part of the Array.&#8221;</p>
<p>This is incomplete at best, wrong at worse.  The sorting and filtering functionality of a Collection class are things you do not get with a simple Array.  I have used the sorting functionality independent of any view components.  The dayRenderers of the Flextras Calendar are sorted in order of their date before the collection is looped over and days are placed on the display.</p>
<p>You also say &#8220;sorting information is shared between Collections&#8221;.</p>
<p>This is a bit misleading.  The example you use is that a collection is shared between two views.  It is true that if you sort the collection the changes will be reflected in both views.  But, sorting is never shared between two separate collections.</p>
<p>Although, I do agree that Collections are best suited for use in views.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Campos</title>
		<link>http://www.unitedmindset.com/jonbcampos/2009/04/03/do-i-use-array-or-arraycollection/#comment-60</link>
		<dc:creator>Jonathan Campos</dc:creator>
		<pubDate>Mon, 23 Nov 2009 22:24:22 +0000</pubDate>
		<guid isPermaLink="false">http://unitedmindset.com/jonbcampos/?p=258#comment-60</guid>
		<description>Yup, just remember that if you set a dataProvider for a List based component, the array will be turned to ArrayCollection, and XML/XMLList or XMLListCollection.</description>
		<content:encoded><![CDATA[<p>Yup, just remember that if you set a dataProvider for a List based component, the array will be turned to ArrayCollection, and XML/XMLList or XMLListCollection.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: anonymenet</title>
		<link>http://www.unitedmindset.com/jonbcampos/2009/04/03/do-i-use-array-or-arraycollection/#comment-59</link>
		<dc:creator>anonymenet</dc:creator>
		<pubDate>Mon, 23 Nov 2009 22:22:16 +0000</pubDate>
		<guid isPermaLink="false">http://unitedmindset.com/jonbcampos/?p=258#comment-59</guid>
		<description>Hoo, wasn&#039;t expecting that sorting feature of ArrayCollection was shared among components using it ! Your solution is great and don&#039;t forget to bind that array of data !

[Bindable]
var array:Array;</description>
		<content:encoded><![CDATA[<p>Hoo, wasn&#8217;t expecting that sorting feature of ArrayCollection was shared among components using it ! Your solution is great and don&#8217;t forget to bind that array of data !</p>
<p>[Bindable]<br />
var array:Array;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wjacker</title>
		<link>http://www.unitedmindset.com/jonbcampos/2009/04/03/do-i-use-array-or-arraycollection/#comment-58</link>
		<dc:creator>wjacker</dc:creator>
		<pubDate>Wed, 28 Oct 2009 10:04:02 +0000</pubDate>
		<guid isPermaLink="false">http://unitedmindset.com/jonbcampos/?p=258#comment-58</guid>
		<description>Good post, Really help me understand the difference between the array and arraycollection. Thanks Jonathan.</description>
		<content:encoded><![CDATA[<p>Good post, Really help me understand the difference between the array and arraycollection. Thanks Jonathan.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Campos</title>
		<link>http://www.unitedmindset.com/jonbcampos/2009/04/03/do-i-use-array-or-arraycollection/#comment-57</link>
		<dc:creator>Jonathan Campos</dc:creator>
		<pubDate>Fri, 03 Apr 2009 23:37:04 +0000</pubDate>
		<guid isPermaLink="false">http://unitedmindset.com/jonbcampos/?p=258#comment-57</guid>
		<description>I agree that array will work out quite often, but when you link to an ilistvollection view you should use an arraycollection such as with a list component or datagrid.</description>
		<content:encoded><![CDATA[<p>I agree that array will work out quite often, but when you link to an ilistvollection view you should use an arraycollection such as with a list component or datagrid.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

