<?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: Why Interfaces In ColdFusion Are Irrelevant</title>
	<atom:link href="http://devnulled.com/content/2006/10/why-interfaces-in-coldfusion-are-irrelevant/feed/" rel="self" type="application/rss+xml" />
	<link>http://devnulled.com/content/2006/10/why-interfaces-in-coldfusion-are-irrelevant/</link>
	<description>devnulled provides news, tips, resources, and articles about various topics that software developers and engineers enjoy.</description>
	<pubDate>Sun, 23 Nov 2008 12:08:03 +0000</pubDate>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>By: Brandon Harper</title>
		<link>http://devnulled.com/content/2006/10/why-interfaces-in-coldfusion-are-irrelevant/#comment-26489</link>
		<dc:creator>Brandon Harper</dc:creator>
		<pubDate>Thu, 12 Oct 2006 05:15:05 +0000</pubDate>
		<guid isPermaLink="false">http://devnulled.com/content/2006/10/why-interfaces-in-coldfusion-are-irrelevant/#comment-26489</guid>
		<description>@Vince

To me an interface gets a varying, loose definition when dealing with a dynamically typed language.  For instance, I've seen at least a couple of proposals for interfaces in Python (which has been around just a little bit longer than CF) but none of them have ever been approved because there are such a large gaps between different people's interpretations of what an interface should do in a dynamic language, its syntax, etc.  

I can understand the slight boost in productivity in implementing an interface tag vs. the code example I used, but otherwise it just seems like a difference in semantics as the functionality is fairly similar as there isn't a way to always ensure a method is going to accept/return what you expect.  I guess it seems more like a template to me?  Granted, I haven't looked at how it's implemented in BD 7 at this point.

@JAlpino

Good point.  I do wish CFC's supported some sort of import statement as other dynamic languages do.  It kind of sucks having to have various objects created instead of just including them with objects that you use them in; in particular utility type components.</description>
		<content:encoded><![CDATA[<p>@Vince</p>
<p>To me an interface gets a varying, loose definition when dealing with a dynamically typed language.  For instance, I&#8217;ve seen at least a couple of proposals for interfaces in Python (which has been around just a little bit longer than CF) but none of them have ever been approved because there are such a large gaps between different people&#8217;s interpretations of what an interface should do in a dynamic language, its syntax, etc.  </p>
<p>I can understand the slight boost in productivity in implementing an interface tag vs. the code example I used, but otherwise it just seems like a difference in semantics as the functionality is fairly similar as there isn&#8217;t a way to always ensure a method is going to accept/return what you expect.  I guess it seems more like a template to me?  Granted, I haven&#8217;t looked at how it&#8217;s implemented in BD 7 at this point.</p>
<p>@JAlpino</p>
<p>Good point.  I do wish CFC&#8217;s supported some sort of import statement as other dynamic languages do.  It kind of sucks having to have various objects created instead of just including them with objects that you use them in; in particular utility type components.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JAlpino</title>
		<link>http://devnulled.com/content/2006/10/why-interfaces-in-coldfusion-are-irrelevant/#comment-26432</link>
		<dc:creator>JAlpino</dc:creator>
		<pubDate>Wed, 11 Oct 2006 23:07:59 +0000</pubDate>
		<guid isPermaLink="false">http://devnulled.com/content/2006/10/why-interfaces-in-coldfusion-are-irrelevant/#comment-26432</guid>
		<description>One benefit of having interfaces in CF that no one seems to have touched on is the fact that they would allow us to extend our components with multiple other components, beyond the single inheritance option we currently have. Sure you could use mixins to add multiple behaviors to another component but I feel it's a very non-oo solution to solving that problem. What happens if I wanted to introspect my duck component to see if it's quackable?</description>
		<content:encoded><![CDATA[<p>One benefit of having interfaces in CF that no one seems to have touched on is the fact that they would allow us to extend our components with multiple other components, beyond the single inheritance option we currently have. Sure you could use mixins to add multiple behaviors to another component but I feel it&#8217;s a very non-oo solution to solving that problem. What happens if I wanted to introspect my duck component to see if it&#8217;s quackable?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vince Bonfanti</title>
		<link>http://devnulled.com/content/2006/10/why-interfaces-in-coldfusion-are-irrelevant/#comment-26388</link>
		<dc:creator>Vince Bonfanti</dc:creator>
		<pubDate>Wed, 11 Oct 2006 17:46:15 +0000</pubDate>
		<guid isPermaLink="false">http://devnulled.com/content/2006/10/why-interfaces-in-coldfusion-are-irrelevant/#comment-26388</guid>
		<description>I meant to say, "it's not possible to check the entire method signature when the CFC is created, only the method name."</description>
		<content:encoded><![CDATA[<p>I meant to say, &#8220;it&#8217;s not possible to check the entire method signature when the CFC is created, only the method name.&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vince Bonfanti</title>
		<link>http://devnulled.com/content/2006/10/why-interfaces-in-coldfusion-are-irrelevant/#comment-26387</link>
		<dc:creator>Vince Bonfanti</dc:creator>
		<pubDate>Wed, 11 Oct 2006 17:45:31 +0000</pubDate>
		<guid isPermaLink="false">http://devnulled.com/content/2006/10/why-interfaces-in-coldfusion-are-irrelevant/#comment-26387</guid>
		<description>You're correct, it's not possible to check the entire method signature when the CFC is created, only the signature name. (By the way, this is consistent with the way it works when you override a CFC super-class method: the override is based only on the method name, not the entire signature as it is in Java.) So it's not perfect, but I wouldn't consider that an argument against interfaces.

I'm drafting a blog entry entitled, "Always Specify Argument and Return Types, and Why Interfaces Are Good" to address these questions, because I think there are a lot of misperceptions and misinformation out there. Unfortunately, I do have a day job, so completing that blog entry may take a few more days...</description>
		<content:encoded><![CDATA[<p>You&#8217;re correct, it&#8217;s not possible to check the entire method signature when the CFC is created, only the signature name. (By the way, this is consistent with the way it works when you override a CFC super-class method: the override is based only on the method name, not the entire signature as it is in Java.) So it&#8217;s not perfect, but I wouldn&#8217;t consider that an argument against interfaces.</p>
<p>I&#8217;m drafting a blog entry entitled, &#8220;Always Specify Argument and Return Types, and Why Interfaces Are Good&#8221; to address these questions, because I think there are a lot of misperceptions and misinformation out there. Unfortunately, I do have a day job, so completing that blog entry may take a few more days&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brandon Harper</title>
		<link>http://devnulled.com/content/2006/10/why-interfaces-in-coldfusion-are-irrelevant/#comment-26382</link>
		<dc:creator>Brandon Harper</dc:creator>
		<pubDate>Wed, 11 Oct 2006 16:57:38 +0000</pubDate>
		<guid isPermaLink="false">http://devnulled.com/content/2006/10/why-interfaces-in-coldfusion-are-irrelevant/#comment-26382</guid>
		<description>Hmm, there are a couple of errors in that code compared to what I typed and I'm not sure why.. must be a problem with the code formatter I'm using.  Anyhow, excuse any obvious problems (ie.. missing a cffunction close tag).</description>
		<content:encoded><![CDATA[<p>Hmm, there are a couple of errors in that code compared to what I typed and I&#8217;m not sure why.. must be a problem with the code formatter I&#8217;m using.  Anyhow, excuse any obvious problems (ie.. missing a cffunction close tag).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brandon Harper</title>
		<link>http://devnulled.com/content/2006/10/why-interfaces-in-coldfusion-are-irrelevant/#comment-26381</link>
		<dc:creator>Brandon Harper</dc:creator>
		<pubDate>Wed, 11 Oct 2006 16:50:05 +0000</pubDate>
		<guid isPermaLink="false">http://devnulled.com/content/2006/10/why-interfaces-in-coldfusion-are-irrelevant/#comment-26381</guid>
		<description>Part of the interface contract in Java is method signatures; you know what data types will be returned, not just that the methods exist.  It sounds like BlueDragon just checks to make sure that a given method is implemented?  I'm not sure how it would be able to catch data type errors at compile time.. i.e., something returned a string instead of an object.

Because of the nature of dynamic languages, there is not a way the compiler can check to ensure a given method will return what you expect.  Here is a poorly and quickly hacked together example (and I'm just making up some cfinterface syntax as I haven't used BD 7.0) which is coded for brevity, but:

Fooable.cfc
[code]
&lt;cfinterface&gt;

	&lt;cffunction name="getInt" returntype="numeric" /&gt;
	
	&lt;cffunction name="isRunning" returntype="string" /&gt;
	
&lt;/cfinterface&gt;
[/code]

Foo.cfc
[code]
&lt;cfcomponent interface="Fooable"&gt;
	
	&lt;cffunction name="init" returntype="any"&gt;
		&lt;cfset Variables.Bar = CreateObject("Bar").init() /&gt;
		&lt;cfreturn this /&gt;
	&lt;/cffunction&gt;

	&lt;cffunction name="getInt" returntype="numeric" /&gt;
		&lt;cfreturn Variables.Bar.getData() /&gt;
	
	
	&lt;cffunction name="isRunning" returntype="boolean"&gt;
		&lt;cfreturn Variables.Bar.returnSelf().isRunning() /&gt;
	&lt;/cffunction&gt;

&lt;/cfcomponent&gt;
[/code]

Bar.cfc
[code]
&lt;cfcomponent&gt;

	&lt;cffunction name="init" returntype="any"&gt;
		&lt;cfreturn this /&gt;
	&lt;/cffunction&gt;
	
	&lt;cffunction name="getData" returntype="numeric" /&gt;
		&lt;cfset var randNum = RandRange(1, 4) /&gt;
		&lt;cfset retValue = "" /&gt;
		
		&lt;cfswitch expression="#randNum#"&gt;
			&lt;cfcase value="1"&gt;
				&lt;cfset retValue = "This is not numeric" /&gt;
			&lt;/cfcase&gt;
			&lt;cfcase value="2"&gt;
				&lt;cfset retValue = StructNew() /&gt;
			&lt;/cfcase&gt;
			&lt;cfcase value="3"&gt;
				&lt;cfreturn this /&gt;
			&lt;/cfcase&gt;
			&lt;cfcase value="4"&gt;
				&lt;cfreturn 123 /&gt;
			&lt;/cfcase&gt;
			&lt;cfcase value="5"&gt;
				&lt;cfreturn true /&gt;
			&lt;/cfcase&gt;
		&lt;/cfswitch&gt;
		
		&lt;cfreturn /&gt;
	
	
	&lt;cffunction name="returnSelf" type="any"&gt;
		&lt;cfreturn getData() /&gt;
	&lt;/cffunction&gt;
	
	&lt;cffunction name="isActive" returntype="boolean"&gt;
		&lt;cfreturn getData() /&gt;
	&lt;/cffunction&gt;
	
&lt;/cfcomponent&gt;
[/code]

There are several obvious problems here that compile time checking of a dynamic language can't check.  Because the compiler can't restrict what you use a given variable for, the method getInt() will compile but will throw runtime errors each time it is called because the interface can't ensure that a value of numeric will be returned.

While you can dictate that methods be defined, there isn't a way to make them follow the contract of what they should return at compile time.  This is not the best example, but it's what I can come-up with without detracting myself from work for too long.

Vince-- what would happen in BD with code similar to this?  Also, can you invoke interfaces as an object or do they act the same as interfaces in Java?</description>
		<content:encoded><![CDATA[<p>Part of the interface contract in Java is method signatures; you know what data types will be returned, not just that the methods exist.  It sounds like BlueDragon just checks to make sure that a given method is implemented?  I'm not sure how it would be able to catch data type errors at compile time.. i.e., something returned a string instead of an object.</p>
<p>Because of the nature of dynamic languages, there is not a way the compiler can check to ensure a given method will return what you expect.  Here is a poorly and quickly hacked together example (and I'm just making up some cfinterface syntax as I haven't used BD 7.0) which is coded for brevity, but:</p>
<p>Fooable.cfc</p>
<div class="igBar"><span id="lcode-1"><a href="#" onclick="javascript:showCodeTxt('code-1'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-1">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;cfinterface&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;cffunction name=<span style="color:#CC0000;">"getInt"</span> returntype=<span style="color:#CC0000;">"numeric"</span> /&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;cffunction name=<span style="color:#CC0000;">"isRunning"</span> returntype=<span style="color:#CC0000;">"string"</span> /&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/cfinterface&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Foo.cfc</p>
<div class="igBar"><span id="lcode-2"><a href="#" onclick="javascript:showCodeTxt('code-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-2">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;cfcomponent interface=<span style="color:#CC0000;">"Fooable"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;cffunction name=<span style="color:#CC0000;">"init"</span> returntype=<span style="color:#CC0000;">"any"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;cfset Variables.<span style="">Bar</span> = CreateObject<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"Bar"</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">init</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> /&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;cfreturn this /&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/cffunction&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;cffunction name=<span style="color:#CC0000;">"getInt"</span> returntype=<span style="color:#CC0000;">"numeric"</span> /&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;cfreturn Variables.<span style="">Bar</span>.<span style="">getData</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> /&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;cffunction name=<span style="color:#CC0000;">"isRunning"</span> returntype=<span style="color:#CC0000;">"boolean"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;cfreturn Variables.<span style="">Bar</span>.<span style="">returnSelf</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">isRunning</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> /&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/cffunction&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/cfcomponent&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Bar.cfc</p>
<div class="igBar"><span id="lcode-3"><a href="#" onclick="javascript:showCodeTxt('code-3'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-3">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;cfcomponent&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;cffunction name=<span style="color:#CC0000;">"init"</span> returntype=<span style="color:#CC0000;">"any"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;cfreturn this /&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/cffunction&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;cffunction name=<span style="color:#CC0000;">"getData"</span> returntype=<span style="color:#CC0000;">"numeric"</span> /&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;cfset var randNum = RandRange<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">1</span>, <span style="color:#800000;color:#800000;">4</span><span style="color:#006600; font-weight:bold;">&#41;</span> /&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;cfset retValue = <span style="color:#CC0000;">""</span> /&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;cfswitch expression=<span style="color:#CC0000;">"#randNum#"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;cfcase value=<span style="color:#CC0000;">"1"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;cfset retValue = <span style="color:#CC0000;">"This is not numeric"</span> /&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/cfcase&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;cfcase value=<span style="color:#CC0000;">"2"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;cfset retValue = StructNew<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> /&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/cfcase&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;cfcase value=<span style="color:#CC0000;">"3"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;cfreturn this /&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/cfcase&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;cfcase value=<span style="color:#CC0000;">"4"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;cfreturn <span style="color:#800000;color:#800000;">123</span> /&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/cfcase&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;cfcase value=<span style="color:#CC0000;">"5"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;cfreturn true /&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/cfcase&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;/cfswitch&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;cfreturn /&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;cffunction name=<span style="color:#CC0000;">"returnSelf"</span> type=<span style="color:#CC0000;">"any"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;cfreturn getData<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> /&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/cffunction&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;cffunction name=<span style="color:#CC0000;">"isActive"</span> returntype=<span style="color:#CC0000;">"boolean"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;cfreturn getData<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> /&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/cffunction&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/cfcomponent&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>There are several obvious problems here that compile time checking of a dynamic language can't check.  Because the compiler can't restrict what you use a given variable for, the method getInt() will compile but will throw runtime errors each time it is called because the interface can't ensure that a value of numeric will be returned.</p>
<p>While you can dictate that methods be defined, there isn't a way to make them follow the contract of what they should return at compile time.  This is not the best example, but it's what I can come-up with without detracting myself from work for too long.</p>
<p>Vince-- what would happen in BD with code similar to this?  Also, can you invoke interfaces as an object or do they act the same as interfaces in Java?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vince Bonfanti</title>
		<link>http://devnulled.com/content/2006/10/why-interfaces-in-coldfusion-are-irrelevant/#comment-26337</link>
		<dc:creator>Vince Bonfanti</dc:creator>
		<pubDate>Wed, 11 Oct 2006 12:37:27 +0000</pubDate>
		<guid isPermaLink="false">http://devnulled.com/content/2006/10/why-interfaces-in-coldfusion-are-irrelevant/#comment-26337</guid>
		<description>"In Java, one of the advantages to using an interface is that it does compile time checking to make sure that classes implementing interfaces follow the contract dictated by the interface. Since ColdFusion is a dynamic language, there really isn't a good way to do compile time checking of interfaces, so it would be a pointless endeavor."

The second part of this statement isn't really accurate. In the BlueDragon 7.0 implementation of CFC interfaces (and abstract CFCs), the check is make at the time a CFC is created using CFOBJECT or CreateObject to make sure it implements the required functions as dictated by the interfaces.

While not as "early" as a compile-time check, it's still better than not getting a runtime error until you actually try to invoke a method that isn't implemented (such as what happens with "duck typing").</description>
		<content:encoded><![CDATA[<p>"In Java, one of the advantages to using an interface is that it does compile time checking to make sure that classes implementing interfaces follow the contract dictated by the interface. Since ColdFusion is a dynamic language, there really isn't a good way to do compile time checking of interfaces, so it would be a pointless endeavor."</p>
<p>The second part of this statement isn't really accurate. In the BlueDragon 7.0 implementation of CFC interfaces (and abstract CFCs), the check is make at the time a CFC is created using CFOBJECT or CreateObject to make sure it implements the required functions as dictated by the interfaces.</p>
<p>While not as "early" as a compile-time check, it's still better than not getting a runtime error until you actually try to invoke a method that isn't implemented (such as what happens with "duck typing").</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom Chiverton</title>
		<link>http://devnulled.com/content/2006/10/why-interfaces-in-coldfusion-are-irrelevant/#comment-26306</link>
		<dc:creator>Tom Chiverton</dc:creator>
		<pubDate>Wed, 11 Oct 2006 08:47:52 +0000</pubDate>
		<guid isPermaLink="false">http://devnulled.com/content/2006/10/why-interfaces-in-coldfusion-are-irrelevant/#comment-26306</guid>
		<description>"the implementation of interfaces in ColdFusion would not prevent someone from breaking the contract of an interface before runtime"
I'm still not sure how you got to that conclusion - a proper interface implementation *would* prevent you from not implementing everything you should by throwing a compile-time error (at first run of the CFC).</description>
		<content:encoded><![CDATA[<p>"the implementation of interfaces in ColdFusion would not prevent someone from breaking the contract of an interface before runtime"<br />
I'm still not sure how you got to that conclusion - a proper interface implementation *would* prevent you from not implementing everything you should by throwing a compile-time error (at first run of the CFC).</p>
]]></content:encoded>
	</item>
</channel>
</rss>
