<?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 Iterator Pattern</title>
	<atom:link href="http://blogs.teamb.com/joannacarter/2004/06/30/697/feed" rel="self" type="application/rss+xml" />
	<link>http://blogs.teamb.com/joannacarter/2004/06/30/697</link>
	<description></description>
	<pubDate>Wed, 17 Mar 2010 06:58:12 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: giulio</title>
		<link>http://blogs.teamb.com/joannacarter/2004/06/30/697#comment-29</link>
		<dc:creator>giulio</dc:creator>
		<pubDate>Tue, 08 Aug 2006 17:49:29 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/joannacarter/2004/06/30/692/#comment-29</guid>
		<description>Why don't to add an implementation template using C# enerics? Anyway... very good! ;-)&lt;br&gt;&lt;br&gt;Bye,&lt;br&gt;Giulio</description>
		<content:encoded><![CDATA[<p>Why don&#8217;t to add an implementation template using C# enerics? Anyway&#8230; very good! <img src='http://blogs.teamb.com/joannacarter/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Bye,<br />
<br />Giulio</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jose Luis</title>
		<link>http://blogs.teamb.com/joannacarter/2004/06/30/697#comment-16</link>
		<dc:creator>Jose Luis</dc:creator>
		<pubDate>Sat, 20 Aug 2005 15:55:57 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/joannacarter/2004/06/30/692/#comment-16</guid>
		<description>If I add the &#34;friendly&#34; class to be able to declare the iterator class into another unit separated from TCustomerList class, I would need to add into the TCustomerIterator unit the uses of the TCustomerList.&lt;br&gt;Then, when I would like to add the GetIterator into the TCustomerList to create the iterator from withing the list ifself, am I going to have a circular reference?&lt;br&gt;</description>
		<content:encoded><![CDATA[<p>If I add the &quot;friendly&quot; class to be able to declare the iterator class into another unit separated from TCustomerList class, I would need to add into the TCustomerIterator unit the uses of the TCustomerList.<br />
<br />Then, when I would like to add the GetIterator into the TCustomerList to create the iterator from withing the list ifself, am I going to have a circular reference?<br />
</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shawn Stamps</title>
		<link>http://blogs.teamb.com/joannacarter/2004/06/30/697#comment-28</link>
		<dc:creator>Shawn Stamps</dc:creator>
		<pubDate>Sun, 10 Jul 2005 19:05:11 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/joannacarter/2004/06/30/692/#comment-28</guid>
		<description>Yes, it is an infinite loop. The correct code would be:&lt;br&gt;&lt;br&gt;Repeat&lt;br&gt;Result := inherited Next;&lt;br&gt;Until Not Result Or Result And CurrentItem.CreditStop;&lt;br&gt;&lt;br&gt;I've coded that kind of error so many times that I usually catch it right after I type it in. ;)&lt;br&gt;</description>
		<content:encoded><![CDATA[<p>Yes, it is an infinite loop. The correct code would be:</p>
<p>Repeat<br />
<br />Result := inherited Next;<br />
<br />Until Not Result Or Result And CurrentItem.CreditStop;</p>
<p>I&#8217;ve coded that kind of error so many times that I usually catch it right after I type it in. <img src='http://blogs.teamb.com/joannacarter/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephen Melnyk</title>
		<link>http://blogs.teamb.com/joannacarter/2004/06/30/697#comment-26</link>
		<dc:creator>Stephen Melnyk</dc:creator>
		<pubDate>Tue, 23 Nov 2004 21:30:54 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/joannacarter/2004/06/30/692/#comment-26</guid>
		<description>Thanks for the article, Joanna.  I appreciate you taking the time to write it.&lt;br&gt;&lt;br&gt;Could you clarify one point for me?  In the Skip Iterators section, you implement TBadCustomerIterator.Next with:&lt;br&gt;&lt;br&gt;    repeat&lt;br&gt;      Result := inherited Next;&lt;br&gt;    until Result and CurrentItem.CreditStop&lt;br&gt;&lt;br&gt;Isn't this an infinite loop?  The last item in the list is going to return False from the inherited Next.&lt;br&gt;&lt;br&gt;Stephen</description>
		<content:encoded><![CDATA[<p>Thanks for the article, Joanna.  I appreciate you taking the time to write it.</p>
<p>Could you clarify one point for me?  In the Skip Iterators section, you implement TBadCustomerIterator.Next with:</p>
<p>    repeat<br />
<br />      Result := inherited Next;<br />
<br />    until Result and CurrentItem.CreditStop</p>
<p>Isn&#8217;t this an infinite loop?  The last item in the list is going to return False from the inherited Next.</p>
<p>Stephen</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: VitoJeng</title>
		<link>http://blogs.teamb.com/joannacarter/2004/06/30/697#comment-13</link>
		<dc:creator>VitoJeng</dc:creator>
		<pubDate>Mon, 18 Oct 2004 09:25:03 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/joannacarter/2004/06/30/692/#comment-13</guid>
		<description>Good article, Joanna!</description>
		<content:encoded><![CDATA[<p>Good article, Joanna!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marcos Barreto</title>
		<link>http://blogs.teamb.com/joannacarter/2004/06/30/697#comment-12</link>
		<dc:creator>Marcos Barreto</dc:creator>
		<pubDate>Sun, 19 Sep 2004 14:13:08 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/joannacarter/2004/06/30/692/#comment-12</guid>
		<description>Could you post a sample deletion with iterators?&lt;br&gt;Thanks!</description>
		<content:encoded><![CDATA[<p>Could you post a sample deletion with iterators?<br />
<br />Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joanna Carter</title>
		<link>http://blogs.teamb.com/joannacarter/2004/06/30/697#comment-21</link>
		<dc:creator>Joanna Carter</dc:creator>
		<pubDate>Wed, 28 Jul 2004 10:40:36 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/joannacarter/2004/06/30/692/#comment-21</guid>
		<description>&#62; A re-evaluation every time the list changes could&lt;br&gt;&#62; be very costly, especially when the structure is&lt;br&gt;&#62; not linear (a tree or something). &lt;br&gt;&lt;br&gt;The Observer Pattern does not re-evaluate the list it merely notifies the Iterator when a Deletion has occurred.&lt;br&gt;&lt;br&gt;&#62; The GoF book says that it is too costly to&lt;br&gt;&#62; duplicate the list of items, but I disagree, there&lt;br&gt;&#62; would have to be a lot of items in that list to be&lt;br&gt;&#62; of any severe consequence when you are simply&lt;br&gt;&#62; holding pointers to objects. &lt;br&gt;&lt;br&gt;Duplicating the list is not the same as creating a list of references to items in an existing list. It involves creating a list of objects that are copies of the objects in the original list.&lt;br&gt;&lt;br&gt;&#62; You could however write a ReverseOrderIterator.&lt;br&gt;&lt;br&gt;That's the beauty of Iterators:-)&lt;br&gt;</description>
		<content:encoded><![CDATA[<p>&gt; A re-evaluation every time the list changes could<br />
<br />&gt; be very costly, especially when the structure is<br />
<br />&gt; not linear (a tree or something). </p>
<p>The Observer Pattern does not re-evaluate the list it merely notifies the Iterator when a Deletion has occurred.</p>
<p>&gt; The GoF book says that it is too costly to<br />
<br />&gt; duplicate the list of items, but I disagree, there<br />
<br />&gt; would have to be a lot of items in that list to be<br />
<br />&gt; of any severe consequence when you are simply<br />
<br />&gt; holding pointers to objects. </p>
<p>Duplicating the list is not the same as creating a list of references to items in an existing list. It involves creating a list of objects that are copies of the objects in the original list.</p>
<p>&gt; You could however write a ReverseOrderIterator.</p>
<p>That&#8217;s the beauty of Iterators:-)<br />
</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wilbert</title>
		<link>http://blogs.teamb.com/joannacarter/2004/06/30/697#comment-10</link>
		<dc:creator>Wilbert</dc:creator>
		<pubDate>Wed, 28 Jul 2004 10:12:02 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/joannacarter/2004/06/30/692/#comment-10</guid>
		<description>&#62; You would never normally use an Iterator for deletions&lt;br&gt;&lt;br&gt;I disagree with this point.  I think that an iterator can be used to perform any operation on a list.&lt;br&gt;&lt;br&gt;&lt;br&gt;&#62; My standard Iterator is attached as an Observer to the list&lt;br&gt;&lt;br&gt;A re-evaluation every time the list changes could be very costly, especially when the structure is not linear (a tree or something).&lt;br&gt;&lt;br&gt;The GoF book says that it is too costly to duplicate the list of items, but I disagree, there would have to be a lot of items in that list to be of any severe consequence when you are simply holding pointers to objects.&lt;br&gt;&lt;br&gt;You could however write a ReverseOrderIterator.&lt;br&gt;</description>
		<content:encoded><![CDATA[<p>&gt; You would never normally use an Iterator for deletions</p>
<p>I disagree with this point.  I think that an iterator can be used to perform any operation on a list.</p>
<p>&gt; My standard Iterator is attached as an Observer to the list</p>
<p>A re-evaluation every time the list changes could be very costly, especially when the structure is not linear (a tree or something).</p>
<p>The GoF book says that it is too costly to duplicate the list of items, but I disagree, there would have to be a lot of items in that list to be of any severe consequence when you are simply holding pointers to objects.</p>
<p>You could however write a ReverseOrderIterator.<br />
</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joanna Carter</title>
		<link>http://blogs.teamb.com/joannacarter/2004/06/30/697#comment-9</link>
		<dc:creator>Joanna Carter</dc:creator>
		<pubDate>Tue, 27 Jul 2004 23:33:20 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/joannacarter/2004/06/30/692/#comment-9</guid>
		<description>You would never normally use an Iterator for deletions unless you first created a List that contains the items to be deleted and then use the Iterator from that list to get the items to delete from the main list.&lt;br&gt;&lt;br&gt;My standard Iterator is attached as an Observer to the list and when the contents of the list changes the Iterator is automatically invalidated by setting it to the end of the list.</description>
		<content:encoded><![CDATA[<p>You would never normally use an Iterator for deletions unless you first created a List that contains the items to be deleted and then use the Iterator from that list to get the items to delete from the main list.</p>
<p>My standard Iterator is attached as an Observer to the list and when the contents of the list changes the Iterator is automatically invalidated by setting it to the end of the list.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wilbert</title>
		<link>http://blogs.teamb.com/joannacarter/2004/06/30/697#comment-8</link>
		<dc:creator>Wilbert</dc:creator>
		<pubDate>Tue, 27 Jul 2004 22:40:36 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/joannacarter/2004/06/30/692/#comment-8</guid>
		<description>Just a small point.  I thought that the iterator was supposed to hold its own list of items rather than depending on the original list?&lt;br&gt;&lt;br&gt;The purpose of this would be&lt;br&gt;&lt;br&gt;while it.Next do&lt;br&gt;  CustomerList.Delete(it.CurrentItem);&lt;br&gt;&lt;br&gt;Which in your example would cause an index out of bounds.</description>
		<content:encoded><![CDATA[<p>Just a small point.  I thought that the iterator was supposed to hold its own list of items rather than depending on the original list?</p>
<p>The purpose of this would be</p>
<p>while it.Next do<br />
<br />  CustomerList.Delete(it.CurrentItem);</p>
<p>Which in your example would cause an index out of bounds.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
