<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: observer design pattern in coldfusion</title>
	<link>http://www.cfdesignpatterns.com/behavioral-patterns/observer-design-pattern-in-coldfusion/</link>
	<description>Using Design Patterns in Coldfusion Programming</description>
	<pubDate>Sun, 20 May 2012 08:15:19 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: Kevin Parker</title>
		<link>http://www.cfdesignpatterns.com/behavioral-patterns/observer-design-pattern-in-coldfusion/#comment-11015</link>
		<dc:creator>Kevin Parker</dc:creator>
		<pubDate>Thu, 15 Oct 2009 03:34:46 +0000</pubDate>
		<guid>http://www.cfdesignpatterns.com/behavioral-patterns/observer-design-pattern-in-coldfusion/#comment-11015</guid>
		<description>Thank you for this post and code: It really helped me understand how to implement the Observer pattern in ColdFusion.

As I played with the example, I noticed that the way you register the listener in your .CFM page doesn't allow me to "unregister" it using that method in the "observable" object. But if I instead create the object separately, then refer to it's variable name in the "registerObserver" method, I could then unregister and reregister it with no problems:
&lt;code&gt;
&lt; cfscript&gt;
userList = CreateObject("component","UserList");
userListLogger = CreateObject("component", "UserListLogger");
userList.registerObserver(userListLogger);
userList.addCustomer( "Larry" );
userList.addCustomer( "Moe" );
userList.unregisterObserver(userListLogger);
userList.addCustomer( "Shemp" );
userList.registerObserver(userListLogger);
userList.addCustomer( "Curly" );
&lt; /cfscript&gt;
&lt;/code&gt;

This would output:

&lt;strong&gt;Larry&lt;/strong&gt; added to the user list
&lt;strong&gt;Moe&lt;/strong&gt; added to the user list
&lt;strong&gt;Curly&lt;/strong&gt; added to the user list

Thanks again for making this make sense to me!</description>
		<content:encoded><![CDATA[<p>Thank you for this post and code: It really helped me understand how to implement the Observer pattern in ColdFusion.</p>
<p>As I played with the example, I noticed that the way you register the listener in your .CFM page doesn&#8217;t allow me to &#8220;unregister&#8221; it using that method in the &#8220;observable&#8221; object. But if I instead create the object separately, then refer to it&#8217;s variable name in the &#8220;registerObserver&#8221; method, I could then unregister and reregister it with no problems:<br />
<pre><code>
&lt; cfscript&gt;
userList = CreateObject(&quot;component&quot;,&quot;UserList&quot;);
userListLogger = CreateObject(&quot;component&quot;, &quot;UserListLogger&quot;);
userList.registerObserver(userListLogger);
userList.addCustomer( &quot;Larry&quot; );
userList.addCustomer( &quot;Moe&quot; );
userList.unregisterObserver(userListLogger);
userList.addCustomer( &quot;Shemp&quot; );
userList.registerObserver(userListLogger);
userList.addCustomer( &quot;Curly&quot; );
&lt; /cfscript&gt;
</code></pre></p>
<p>This would output:</p>
<p><strong>Larry</strong> added to the user list<br />
<strong>Moe</strong> added to the user list<br />
<strong>Curly</strong> added to the user list</p>
<p>Thanks again for making this make sense to me!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bruce</title>
		<link>http://www.cfdesignpatterns.com/behavioral-patterns/observer-design-pattern-in-coldfusion/#comment-4</link>
		<dc:creator>Bruce</dc:creator>
		<pubDate>Tue, 15 Apr 2008 01:03:57 +0000</pubDate>
		<guid>http://www.cfdesignpatterns.com/behavioral-patterns/observer-design-pattern-in-coldfusion/#comment-4</guid>
		<description>very easy to follow explanation and example of this pattern - thank you for posting it</description>
		<content:encoded><![CDATA[<p>very easy to follow explanation and example of this pattern - thank you for posting it</p>
]]></content:encoded>
	</item>
</channel>
</rss>

