<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>DEfusion.org.uk &#187; Coldfusion</title>
	<atom:link href="http://www.defusion.org.uk/archives/category/web-development/coldfusion/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.defusion.org.uk</link>
	<description>I too will force my opinions on you</description>
	<lastBuildDate>Mon, 04 Jul 2011 19:28:08 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Code: CFStatShot Yahoo Widget</title>
		<link>http://www.defusion.org.uk/archives/2007/08/02/code-cfstatshot-yahoo-widget/</link>
		<comments>http://www.defusion.org.uk/archives/2007/08/02/code-cfstatshot-yahoo-widget/#comments</comments>
		<pubDate>Thu, 02 Aug 2007 21:00:53 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Coldfusion]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.defusion.org.uk/archives/2007/08/02/code-cfstatshot-yahoo-widget/</guid>
		<description><![CDATA[
I&#8217;m releasing a Yahoo Widget that I created a long time ago and have been meaning to release for quite a while too.
The story all begins when I took over the Coldfusion platform support for, I started to find myself spending a bit of time watching cfstat on the servers to get a feel for [...]]]></description>
			<content:encoded><![CDATA[<p><a href="/code/cfstatshot-cfstat-yahoo-desktop-widget/"><img class="featureImg" src="/wp-content/uploads/2007/08/cfstatshot.png" alt="CFStatShot watching multiple Coldfusion servers" /></a><br />
I&#8217;m releasing a <a href="http://widgets.yahoo.com/">Yahoo Widget</a> that I created a long time ago and have been meaning to release for quite a while too.</p>
<p>The story all begins when I took over the Coldfusion platform support for, I started to find myself spending a bit of time watching <span class="code">cfstat</span> on the servers to get a feel for the current status of the machines. As we had multiple servers (then 4, now 6) and only being able to get to cfstat directly on the machine, this was not really practicable.</p>
<p>What I really wanted was a little desktop application that could give me the headlines of <span class="code">cfstat</span> for as many servers as we had, all in an easy to digest format, the result is the <a href="/code/cfstatshot-cfstat-yahoo-desktop-widget/">CFStatShot Yahoo Desktop Widget</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.defusion.org.uk/archives/2007/08/02/code-cfstatshot-yahoo-widget/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Coldfusion, lsParseTime and Date Strangeness</title>
		<link>http://www.defusion.org.uk/archives/2007/03/28/coldfusion-lsparsetime-and-date-strangeness/</link>
		<comments>http://www.defusion.org.uk/archives/2007/03/28/coldfusion-lsparsetime-and-date-strangeness/#comments</comments>
		<pubDate>Wed, 28 Mar 2007 10:41:40 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Coldfusion]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.defusion.org.uk/archives/2007/03/28/coldfusion-lsparsetime-and-date-strangeness/</guid>
		<description><![CDATA[I had the following date string from a data dump file 11-APR-07, without looking at the Coldfusion documentation I pass the string to lsParseDateTime() and dump the output to see if it parses the string correctly, which results in {ts &#8216;2007-04-11 00:00:00&#8242;}.
Great it worked! So I move on to writing my test case (yes, yes [...]]]></description>
			<content:encoded><![CDATA[<p>I had the following date string from a data dump file <span class="code">11-APR-07</span>, without looking at the <a href="http://livedocs.adobe.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=ColdFusion_Documentation&#038;file=00000579.htm#133322">Coldfusion documentation</a> I pass the string to <span class="code">lsParseDateTime()</span> and dump the output to see if it parses the string correctly, which results in <span class="code">{ts &#8216;2007-04-11 00:00:00&#8242;}</span>.</p>
<p>Great it worked! So I move on to writing my test case (yes, yes I know it should have been the other way around).<br />
<span id="more-117"></span><br />
So I write a few tests to give different date stings in the dump format and then compare them against Coldfusion objects. All of them fail.</p>
<p>I dig deeper, dumping the dates and get the following:</p>
<dl>
<dt>strDate:</dt>
<dd>11-APR-07</dd>
<dt>expectedDate:</dt>
<dd>{ts &#8216;2007-04-11 00:00:00&#8242;}</dd>
<dt>actualDate:</dt>
<dd>{ts &#8216;2007-04-11 00:00:00&#8242;}</dd>
<dt>dateCompare( expectedDate, actualDate, &#8216;D&#8217; ):</dt>
<dd>1</dd>
</dl>
<p>That&#8217;s strange the string representations of the dates sure do look the same. So I change the dump to dump the values from the date object (the day, month, year values) and get the following:</p>
<dl>
<dt>strDate:</dt>
<dd>11-APR-07</dd>
<dt>expectedDate:</dt>
<dd>{ts &#8216;2007-04-11 00:00:00&#8242;} &#8212; day: 11 month: 4 year: 2007</dd>
<dt>actualDate:</dt>
<dd>{ts &#8216;2007-04-11 00:00:00&#8242;} &#8212; day: 11 month: 4 year: 7</dd>
<dt>dateCompare( expectedDate, actualDate, &#8216;D&#8217; ):</dt>
<dd>1</dd>
</dl>
<p>Ok, now I see &#8211; it&#8217;s seeing the year from the date string as 07, that&#8217;s fair enough, but why is the string representation showing 2007. </p>
<p>With a bit more digging (trying to create random date objects) it appears that before the year 100 Coldfusion doesn&#8217;t actually create a date object with the year you asked for but instead guesses you meant either 20xx or 19xx with the cross-over point being 30. Any date objects created with a year of 1-29 will return 20xx and any between 30-99 will return 19xx, any other positive integer will return the provided year (negative integers do something weird).</p>
<p>At least I&#8217;m not trying to write something that will need to handle years older than the year 100, but there go my plans for the killer web application to manage museum artefacts.</p>
<p>Note: This is where someone points out the CF documentation (on that hideously slow reference site) which says exactly what I discovered (but in a more concise and articulate form).</p>]]></content:encoded>
			<wfw:commentRss>http://www.defusion.org.uk/archives/2007/03/28/coldfusion-lsparsetime-and-date-strangeness/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reader question: Coldfusion hosting</title>
		<link>http://www.defusion.org.uk/archives/2007/03/02/reader-question-coldfusion-hosting/</link>
		<comments>http://www.defusion.org.uk/archives/2007/03/02/reader-question-coldfusion-hosting/#comments</comments>
		<pubDate>Fri, 02 Mar 2007 11:20:57 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Coldfusion]]></category>
		<category><![CDATA[Outer Monologue]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.defusion.org.uk/archives/2007/03/02/reader-question-coldfusion-hosting/</guid>
		<description><![CDATA[I and a small team have been writing a small application in PHP using CakePHP, which we all have an ongoing  love-hate relationship with.
However we have been thinking that to really get things moving forward quicker we might move to Coldfusion. We currently have a dedicated server which runs my family of sites which [...]]]></description>
			<content:encoded><![CDATA[<p>I and a small team have been writing a small application in <acronym title="Hypertext PreProcessing">PHP</acronym> using CakePHP, which we all have an ongoing  love-hate relationship with.</p>
<p>However we have been thinking that to really get things moving forward quicker we might move to Coldfusion. We currently have a dedicated server which runs my family of sites which is a LAMP box running.<br />
<span id="more-115"></span><br />
So I have an open question to any of my readers, what would you guys see as the best option moving forward:</p>
<ol>
<li>Coldfusion installation on our current web server &#8211; I have no experience of installing CF on Linux, I don&#8217;t know what kind of overhead it has etc.</li>
<li>Coldfusion hosting, if this is an option we want it to be flexible but as inexpensive as possible &#8211; any suggested hosts.</li>
</ol>
<p>This is just a whim at the moment and I haven&#8217;t performed any real research into the above options (yet) so I thought I&#8217;d just throw it out and see what other people think.</p>
<p> <a href="http://www.canadianwebhosting.com">Web Hosting</a> in Canada, 24/7 Toll Free Support. Starts $3.95/m. Canadianwebhosting.com</p>]]></content:encoded>
			<wfw:commentRss>http://www.defusion.org.uk/archives/2007/03/02/reader-question-coldfusion-hosting/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Object Instantiation in Coldfusion</title>
		<link>http://www.defusion.org.uk/archives/2006/12/12/object-instantiation-in-coldfusion/</link>
		<comments>http://www.defusion.org.uk/archives/2006/12/12/object-instantiation-in-coldfusion/#comments</comments>
		<pubDate>Tue, 12 Dec 2006 22:22:35 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Coldfusion]]></category>
		<category><![CDATA[OOP]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.defusion.org.uk/archives/2006/12/12/object-instantiation-in-coldfusion/</guid>
		<description><![CDATA[As I have mentioned before, or as anyone who practices OO in Coldfusion will know, that object instantiation in Coldfusion has quite a bit of overhead.
I&#8217;ve seen a few thoughts about how to best work around this, such as the above post on Java vs CFC instantiation by Mark Drew and the ideas presented by [...]]]></description>
			<content:encoded><![CDATA[<p>As I have <a href="/archives/2006/08/23/oh-oh-coldfusion-daos-gateways-beans/">mentioned before</a>, or as anyone who practices OO in Coldfusion will know, that object instantiation in Coldfusion has <a href="http://www.markdrew.co.uk/blog/index.cfm/2006/11/30/Java-and-CFC-instantiation-comparing-the-engines">quite a bit of overhead</a>.</p>
<p>I&#8217;ve seen a few thoughts about how to best work around this, such as the <a href="http://www.markdrew.co.uk/blog/index.cfm/2006/11/30/Java-and-CFC-instantiation-comparing-the-engines">above post on Java vs CFC instantiation</a> by <a href="http://www.markdrew.co.uk/">Mark Drew</a> and the ideas presented by <a href="http://www.pbell.com/">Peter Bell</a> with regards to <a href="http://www.pbell.com/index.cfm/2006/7/15/Real-World-Benefits-of-Iterating-Business-Objects-over-Recordset">iterating business objects</a> which I&#8217;ve <a href="/archives/2006/08/23/oh-oh-coldfusion-daos-gateways-beans/">mentioned before</a>.<br />
<span id="more-97"></span><br />
But to be honest I&#8217;ve not explored either of these in any great detail, although I really wish I could devote some time to looking at them.</p>
<p>Another, and easier and more instant, solution appears to have been suggested by Brandon over at <a href="http://devnulled.com/">devnulled</a> in his post on <a href="http://devnulled.com/content/2006/12/under-the-hood-how-the-coldfusion-compiler-works/">how the Coldfusion compiler works</a> in the following aside:</p>
<blockquote cite="http://devnulled.com/content/2006/12/under-the-hood-how-the-coldfusion-compiler-works/"><p>
A related thing to note that he doesnâ€™t cover is how much faster it is to instantiate objects in cfscript rather than CFML on a percentage basis. Just some food for thought. I can do a follow-up post on this in particular topic if anyone is interested.
</p></blockquote>
<p>Of course we&#8217;re interested in a follow up post. After reading this I spent a few minutes testing this out with a few different CFCs from our model; beans, gateways etc. </p>
<p>I was only looking at the average time of instantiation in either 100 and 1000 iterations and although I did see a tiny improvement in the average time in cfscript I won&#8217;t be going out and rewriting all the code that uses cfset to instantiate CFCs just yet.</p>
<p>I&#8217;m hoping that Brandon has some hidden trick or information up his sleeve and I&#8217;m dying to read a post on it (and I&#8217;d say as much in the comments on this post if it would let me, every time I try it doesn&#8217;t get added to the post) and find out there really is a marked difference between the two.</p>
<p>Personally I find it easier to read <a href="http://en.wikipedia.org/wiki/ECMAScript">ECMAScript</a> syntax rather than the tags in Coldfusion, so I use it wherever I can already. But if there is a speed benefit for using cfscript when instantiating CFCs then I can use that as leverage to get the rest of the team at work to start to use cfscript wherever possible. Which would be nice.</p>
<p><strong>Update:</strong> I&#8217;ve just found <a href="http://www.nomachetejuggling.com/2006/12/07/coldfusions-compiler/">a post on the Coldfusion compiler</a> over at <a href="http://www.nomachetejuggling.com/">Absolutely No Machete Juggling</a> that goes into detail about exploring the differences between the resultant compiled Coldfusion code in a simple test (not related to CFC instantiation). The important notes that may apply to CFC instantiation appear towards the bottom of the post:</p>
<blockquote><p>
So there you have it, the SetVariable implementation is slow&#8230;</p>
<p>CFScript [when compiled]  doesnâ€™t use SetVariable, so if youâ€™re doing heavy loop code like this, Iâ€™d recommend writing it using CFScript rather than CFML.
</p></blockquote>]]></content:encoded>
			<wfw:commentRss>http://www.defusion.org.uk/archives/2006/12/12/object-instantiation-in-coldfusion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SFTP In Coldfusion</title>
		<link>http://www.defusion.org.uk/archives/2006/12/08/sftp-in-coldfusion/</link>
		<comments>http://www.defusion.org.uk/archives/2006/12/08/sftp-in-coldfusion/#comments</comments>
		<pubDate>Fri, 08 Dec 2006 17:49:38 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Coldfusion]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.defusion.org.uk/archives/2006/12/08/sftp-in-coldfusion/</guid>
		<description><![CDATA[I&#8217;ve just had to work on a task which creates a couple of CSV report files for an external business partner and then uploads them to their secure FTP server. In it&#8217;s original state it was using the Putty FTP client by writing a batch file and then having a scheduled task execute that batch [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just had to work on a task which creates a couple of CSV report files for an external business partner and then uploads them to their secure <acronym title="File Transfer Protocol">FTP</acronym> server. In it&#8217;s original state it was using the <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html">Putty <acronym title="File Transfer Protocol">FTP</acronym></a> client by writing a batch file and then having a scheduled task execute that batch file later (as the Coldfusion could not execute the batch file).<br />
<span id="more-94"></span><br />
The problem with this, other than being long winded, was that there were no checks in place to verify whether the upload was successful or not. The only way this could be checked in the existing implementation was to manually log into the <acronym title="File Transfer Protocol">FTP</acronym> server at a later time and make sure the file was there.</p>
<p>I decided to try see if Java had any way of handling SFTP and potentially writing a CFC wrapper for it myself, but luckily Michael Traher over at <a href="http://www.socialpoints.com/blog/client/index.cfm">Social Points</a> had already implemented a <a href="http://www.socialpoints.com/blog/client/index.cfm/2006/3/25/coldfusion-sftp">wrapper</a>  for <a href="http://www.jcraft.com/jsch/index.html">JSch &#8211; Java Secure Channel</a>.</p>
<p>It&#8217;s fairly straight forward to use, but could do with a bit more inline comments to help clarify the interface. One thing to note is if you need to use a private key to log into the SFTP server then make sure that it is in the OpenSSH format, which with PuttyGen was a really quick thing to do once I&#8217;d figured out the problem (by looking at through <a href="http://sourceforge.net/mailarchive/forum.php?forum=jsch-users">JSch mailing list archive</a>.</p>
<p>So now the task creates the files and uploads them reporting the success or failure automatically.</p>]]></content:encoded>
			<wfw:commentRss>http://www.defusion.org.uk/archives/2006/12/08/sftp-in-coldfusion/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>When WSConfig Attacks</title>
		<link>http://www.defusion.org.uk/archives/2006/09/26/when-wsconfig-attacks/</link>
		<comments>http://www.defusion.org.uk/archives/2006/09/26/when-wsconfig-attacks/#comments</comments>
		<pubDate>Tue, 26 Sep 2006 21:08:50 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Coldfusion]]></category>
		<category><![CDATA[Outer Monologue]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.defusion.org.uk/archives/2006/09/26/when-wsconfig-attacks/</guid>
		<description><![CDATA[At work today I spent quite a bit of time shouting and throwing things at my monitor, it tends to take the brunt of my frustrations when things really annoy me. The reason for my frustration today was Coldfusion&#8217;s WSConfig tool, which is supposed to easily allow you to configure web servers or individual sites [...]]]></description>
			<content:encoded><![CDATA[<p>At work today I spent quite a bit of time shouting and throwing things at my monitor, it tends to take the brunt of my frustrations when things really annoy me. The reason for my frustration today was <a href="http://www.adobe.com/products/coldfusion/">Coldfusion&#8217;s</a> <a href="http://livedocs.macromedia.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=ColdFusion_Documentation&#038;file=00000049.htm">WSConfig</a> tool, which is supposed to easily allow you to configure web servers or individual sites (in the case of <acronym title="Internet Infomation Server">IIS</acronym> anyway, I&#8217;ve not tried with Apache yet) to work with the Coldfusion JRun connector.<br />
<span id="more-81"></span><br />
I&#8217;ve never had reason to touch this in the past, but a few days ago I was playing around with Flash forms in CF and I had a problem where the loading (clock) cursor never went away, the solution it seems (for no explanation that I could find, other than &quot;it works&quot;) was to remove the Coldfusion configuration from <acronym title="Internet Infomation Server">IIS</acronym> and re-apply it, using WSConfig. So I did that late last week and everything was good and it gave me a little fuzzy feeling inside, the clock cursor no longer hounded me within my Flash forms.</p>
<p>Fast forward to today and I switch sites in <acronym title="Internet Infomation Server">IIS</acronym> to test something else and suddenly <acronym title="Internet Infomation Server">IIS</acronym> is serving the Coldfusion pages as octet streams and the browser is asking if I want to save or open them, this is not good. So I go through the whole process of removing and adding CF again via WSConfig, no luck. I manually restart <acronym title="Internet Infomation Server">IIS</acronym> and then Coldfusion, still no luck. I go back to the first site, the one with the flash forms, and that&#8217;s not working anymore. Hmmmm.</p>
<p>After a bit more fiddling I figure out that if I type in the exact <acronym title="Uniform Resource Locator">URL</acronym> of a template (e.g. index.cfm) everything works fine, the problem is only occurring when <acronym title="Internet Infomation Server">IIS</acronym> is trying to hit a default document that is a CF file or catch an error that redirects to a CF file; which is odd.</p>
<p>I spend what seems like hours (in between other things I&#8217;m doing) spent in an endless circle of removing and re-applying the CF configuration using WSConfig, restarting CF, searching on the web for ideas and similar problems, restarting <acronym title="Internet Infomation Server">IIS</acronym>, restarting the machine, shouting at the monitor and throwing things (not necessarily in that order). I even tried searching for &quot;WSConfig is rubbish&quot;, which returned nothing at all &#8211; which isn&#8217;t very helpful.</p>
<p>I eventually found a <a href="http://blog.maestropublishing.com/index.cfm?mode=entry&#038;entry=D578A889-C573-DF31-327DBF8AFF718809">very handy post</a> by <a href="http://blog.maestropublishing.com/">Peter J. Farrell</a>, as an aside I&#8217;ve always wondered what makes a person choose to use one or more of their initials in every day use &#8211; I guess for actors and writers it has something to do with previous artists and to avoid confusion with them. Anyway I&#8217;m getting distracted from the point; which was <a href="http://blog.maestropublishing.com/index.cfm?mode=entry&#038;entry=D578A889-C573-DF31-327DBF8AFF718809">the post by Peter</a> that saved my afternoon. Although the problems described didn&#8217;t directly relate to my problem, I wasn&#8217;t getting the same error messages and I&#8217;m using <acronym title="Internet Infomation Server">IIS</acronym>, it also didn&#8217;t appear under a search for &quot;WSConfig is rubbish&quot; but I gave it a try. </p>
<p>Two minutes later me, Coldfusion, <acronym title="Internet Infomation Server">IIS</acronym> and my monitor (and possibly my work who colleagues may have been thinking I was slightly unhinged) were happy once again.</p>
<p>So if you have any sort of problems with WSConfig, be sure to give Peters <a href="http://blog.maestropublishing.com/index.cfm?mode=entry&#038;entry=D578A889-C573-DF31-327DBF8AFF718809">post</a> a try, it could be the difference between sanity and eating cereal from a slipper &#8211; with a comb.</p>]]></content:encoded>
			<wfw:commentRss>http://www.defusion.org.uk/archives/2006/09/26/when-wsconfig-attacks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oh Oh; Coldfusion DAOs, Gateways &amp; Beans</title>
		<link>http://www.defusion.org.uk/archives/2006/08/23/oh-oh-coldfusion-daos-gateways-beans/</link>
		<comments>http://www.defusion.org.uk/archives/2006/08/23/oh-oh-coldfusion-daos-gateways-beans/#comments</comments>
		<pubDate>Wed, 23 Aug 2006 07:30:15 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Coldfusion]]></category>
		<category><![CDATA[Outer Monologue]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.defusion.org.uk/archives/2006/08/23/oh-oh-coldfusion-daos-gateways-beans/</guid>
		<description><![CDATA[Recently I&#8217;ve been trying to catch up with a huge backlog of my Podcasts and while listening through these recently one of them made me emotional enough to shout at my radio in the car. So I figured if this was something that had the ability to get me that emotional, maybe I should share [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve been trying to catch up with a huge backlog of my Podcasts and while listening through these recently one of them made me emotional enough to shout at my radio in the car. So I figured if this was something that had the ability to get me that emotional, maybe I should share my reasons for this with others, so here I am, I&#8217;m a sharing kind of guy (unless it&#8217;s my round).</p>
<p>The topic in question that got me shouting at my radio and making fellow commuters stare ahead more intensely than before was Object Orientated Programming, more specifically the use of some of the basic data OO patterns within Coldfusion.<br />
<span id="more-66"></span></p>
<p>I must state here that I am still a long way behind catching up with the backlog of my Podcasts and if the points I raise here have been raised or addressed in later editions of the Podcasts in question then I apologise for any overlap of thoughts or information.</p>
<p>Anyway, back to the post.</p>
<p>I&#8217;d just finished listening to <a href="http://helmsandpeters.com/">Helms and Peters Podcast</a> episode 26, Groupthink, in which Hal has what you could call a little rant about developers who use only the most basic OO design patterns, mostly being the data-centric patterns such as Data Access Object, Value Objects/Data Transfer Objects/ Beans &amp; Gateways and declare themselves to be OO developers.</p>
<p>I couldn&#8217;t have agreed more, although these patterns are the workhorses of most web applications they are a huge step away from really digging into the domains you are dealing with and modelling them effectively within your software. They are in fact patterns that are used very heavily in the applications I deal with, but they are so boring and repetitive that I make as quick of an overview of the patterns when introducing our new developers at work to our applications. It takes two minutes to get your head around them and then move onto the more interesting patterns. </p>
<p>As an aside, this is also part of the reason I am researching <a href="http://www.cakephp.org/">CakePHP</a> for my personal <acronym title="Hypertext PreProcessing">PHP</acronym> based work and <a href="http://www.doughughes.net/index.cfm?filter=category&#038;categoryId=30">Reactor</a> for my Coldfusion work. I&#8217;m really sick of creating DAOs in particular, OK so I&#8217;ve got the process down to the bare minimum in <a href="http://www.cfeclipse.org/">CFEclipse</a> using snippets, and I&#8217;ve got a sweet generic <span class="code">persist()</span> method in the DAOs that, combined with the dirty marker pattern, deals with whether to call the <span class="code">create</span>, <span class="code">update</span> or <span class="code">delete</span> method as appropriate, but I&#8217;ve had enough now, I&#8217;ve got better things to do with my time.</p>
<p>Back in my car I move onto the next Podcast on the list, which was the <a href="http://www.coldfusionweekly.com/">Coldfusion Weekly Podcast</a> <a href="http://www.coldfusionweekly.com/index.cfm?event=showArchive#1-10">Version 1.10 Safari Edition</a> where the topic was a design pattern Safari; an introduction to design patterns  covering DAOs, Gateways, Beans and Services/Managers.</p>
<p>As an introduction to design patterns these are probably the easiest to cover, as they are so simple and anyone who creates a web application will probably need these. It was kind of a co-incidence that the subject of these two Podcasts overlapped a little. The Podcast was a quick and easy introduction to design patterns and why to use them and as I say covered a few of the basic ones.</p>
<p><strong>Now to the real point.</strong></p>
<p>Talking about Beans and persisting data the Podcast covered the common argument of &quot;this seems like a lot of overhead to just get at my data&quot; by making the following points:</p>
<ul>
<li>Getters and setters give you lots of control over access to the data.</li>
<li>You may want to make some information read only, which can be accomplished by making the setters private.</li>
<li>You may want to restrict access to data for certain users/groups etc. (although I believe the Bean shouldn&#8217;t really know about that).</li>
<li>Validate data passed to setters.</li>
<li>Allows Bean composition. A Person Bean could contain one or more Telephone Beans an Address Bean etc.</li>
<li>Beans and especially composite Beans are consistent with the way you think about the data relationships in the real world (this is touching on domain modelling).</li>
<li>Easier to swap persistence methods (e.g. database or file system etc.), this was covered when they discussed DAOs, but also applies to Beans.</li>
</ul>
<p>There are some points I would like to add to that list:</p>
<ul>
<li>The rest of your model and application(s) don&#8217;t need to know the structure of the database, how to deal with result sets from the database etc. just the interface of the bean.</li>
<li>Your getters can encapsulate regular data manipulation tasks. For example say you have an Address bean with the fields: address1, address2, city, county, postcode. A common requirement for addresses is to format them as a concatenated string (usually with commas and spaces) while ensuring some of the optional data (e.g. address2 or county) is handled correctly. In my opinion this kind of functionality really deserves to be encapsulated in a method on the Bean such as <span class="code">getFullPostalAddress()</span>.</li>
</ul>
<p>So this was great, a fine example of defending what some beginners in OO see as a un-necessary overhead to &quot;just get at the data&quot;, fantastic &#8211; if I wasn&#8217;t sold on Beans before I would have been after listening to that.</p>
<p>After that they skim over DAOs, again giving you the right amount of information about DAOs.</p>
<p>Next is where it all went wrong for me, Gateways. They jump in head first stating with CF they return queries from their Gateways rather than arrays of Beans because it&#8217;s easier and quicker (CF does have some sweet query iterators) to use these rather than Beans.</p>
<p><strong>&quot;Hold on!&quot;</strong> You may gasp (or shout at your car radio). &quot;Haven&#8217;t they just spent the last few minutes extolling the benefits of Beans, their encapsulation of data and powerful yet simple interfaces to said data etc.&quot;.</p>
<p>If you didn&#8217;t, you should have and I believe that you would be right to. Not only do we lose all those benefits of Beans that have just been covered, we now have the possibility of having to write two types of views (in a Model View Controller based application) to do the same thing depending on whether we&#8217;re dealing with a single entity or multiple entities and lots more problems. It&#8217;s all so messy.</p>
<p>So why are we in the position where it&#8217;s become common practice to have Gateways returning query objects willy-nilly in CF and why did we lose sight of the benefits of Beans so quickly?</p>
<p>Well with OO in CF we <em>currently</em> (fingers crossed this can be resolved) have a small problem, instantiating objects adds quite a lot of overhead. I can&#8217;t remember the exact figures, and it probably isn&#8217;t a consistent amount for all objects, but somewhere around 40ms is something that I remember being quoted to me. This is obviously a problem if we want to return lots of populated Beans from a gateway as an array, just instantiating 10 of them will add nearly half a second to your execution time.</p>
<p>This wasn&#8217;t really covered in the Podcast but really deserved to be. Before I continue I must say that I am myself guilty of using Gateways to return query record sets, basically because I didn&#8217;t know any better, but it is something I intend address in the near future.</p>
<p><strong>So what can we return from Gateways in Coldfusion?</strong></p>
<p>The absolutely fantastic (and prolific) <a href="http://www.pbell.com/">Application Generation</a> blog by Peter Bell offers what I believe to be the best solution I&#8217;ve seen so far, <a href="http://www.pbell.com/index.cfm/2006/7/15/Real-World-Benefits-of-Iterating-Business-Objects-over-Recordset">Iterating Business Objects</a>. </p>
<p>The basic principle is you have a Bean (Business Object) that knows how to take a query from a Gateway and then iterate over the query populating itself on request. This way we retain the power of the Bean but don&#8217;t add the overhead of object instantiation and everyone is happy, although it&#8217;d be nice to retain something as simple as <span class="code">&lt;cfquery&gt;</span> for the iteration.</p>
<p>I was planning to say a little about this idea and link to all these fantastic posts from <a href="http://www.pbell.com/">Application Generation</a> and now seems the perfect time to do so. I&#8217;m not going to re-hash the detail from the posts but they are all definite must reads for any CFer:</p>
<ul>
<li><a href="http://www.pbell.com/index.cfm/2006/7/11/Returning-data-Beans-vs-Queries">Returning data Beans vs Queries</a></li>
<li><a href="http://www.pbell.com/index.cfm/2006/7/12/An-Iterating-Business-Object">An Iterating Business Object</a></li>
<li><a href="http://www.pbell.com/index.cfm/2006/7/15/Real-World-Benefits-of-Iterating-Business-Objects-over-Recordset">Real World Benefits of Iterating Business Objects over Recordset</a></li>
<li><a href="http://www.pbell.com/index.cfm/2006/7/27/Snippets-The-Base-Iterating-Business-Object">Snippets The Base Iterating Business Object</a></li>
<li><a href="http://www.pbell.com/index.cfm/2006/7/27/Snippets-Displaying-an-Iterating-Object">Snippets Displaying an Iterating Object</a></li>
</ul>
<p>I hope this post doesn&#8217;t come across as me bashing the <a href="http://www.coldfusionweekly.com/">Coldfusion Weekly Podcast</a>, because that was not the aim &#8211; it&#8217;s one of my few regular Podcasts I listen to. My aim was only to point out that when it comes to Gateways I think we can all do a lot more to work around some of the limitations of CF without losing the benefits of Beans.</p>]]></content:encoded>
			<wfw:commentRss>http://www.defusion.org.uk/archives/2006/08/23/oh-oh-coldfusion-daos-gateways-beans/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Interview on Web Wire</title>
		<link>http://www.defusion.org.uk/archives/2006/08/05/interview-on-web-wire/</link>
		<comments>http://www.defusion.org.uk/archives/2006/08/05/interview-on-web-wire/#comments</comments>
		<pubDate>Sat, 05 Aug 2006 13:38:38 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Coldfusion]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Outer Monologue]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.defusion.org.uk/archives/2006/08/05/interview-on-web-wire/</guid>
		<description><![CDATA[I was notified yesterday by a friend of mine Martin Laine that Ben Forta had blogged about a interview with me on Web Wire.
First of all, wow, Ben Forta &#8211; so it was just a passing mention, but for anyone working in the CF or Flex development fields Ben Forta is a very important and [...]]]></description>
			<content:encoded><![CDATA[<p>I was <a href="http://www.1pixelout.net/2006/08/04/dave-spurr-interview-on-webwire/">notified</a> yesterday by a friend of mine <a href="http://www.1pixelout.net/">Martin Laine</a> that <a href="http://www.forta.com/blog/">Ben Forta</a> had <a href="http://www.forta.com/blog/index.cfm/2006/8/3/Superbreak-Powered-By-ColdFusion">blogged</a> about a <a href="http://webwire.com/ViewPressRel.asp?aId=17886">interview with me on Web Wire</a>.</p>
<p>First of all, wow, Ben Forta &#8211; so it was just a passing mention, but for anyone working in the CF or Flex development fields Ben Forta is a very important and influential figure. Secondly, I still find it amazing how quickly the web moves, I received the final copy of the interview copy in my inbox on Thursday afternoon and by Friday morning it had been picked up by Ben Forta and relayed to myself via Martin.</p>
<p>Finally the interview on Web Wire appears to have been edited a little, I&#8217;ll try and get my hands on the original and post it here.</p>]]></content:encoded>
			<wfw:commentRss>http://www.defusion.org.uk/archives/2006/08/05/interview-on-web-wire/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Well Flex Me</title>
		<link>http://www.defusion.org.uk/archives/2006/04/28/well-flex-me/</link>
		<comments>http://www.defusion.org.uk/archives/2006/04/28/well-flex-me/#comments</comments>
		<pubDate>Fri, 28 Apr 2006 21:47:44 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Coldfusion]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Outer Monologue]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.defusion.org.uk/archives/2006/04/28/well-flex-me/</guid>
		<description><![CDATA[A couple of weekends ago I took my first real look at Flex 2.0 Beta. To say that I loved it is an understatement, I&#8217;ve even added a Flex category to my site in anticipation of many future posts about it. 
I simply spent the weekend watching the demo videos &#038; running through all of [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of weekends ago I took my first real look at <a href="http://labs.macromedia.com/flexproductline/">Flex 2.0 Beta</a>. To say that I loved it is an understatement, I&#8217;ve even added a <a href="/archives/category/web-development/flex/">Flex category</a> to my site in anticipation of many future posts about it. </p>
<p>I simply spent the weekend watching the demo videos &#038; running through all of the tutorials and then started to play around with the <a href="http://labs.macromedia.com/wiki/index.php/ColdFusion/Flex_Connectivity">Coldfusion/Flex connectivity</a> and believe I grasped a large amount of how to work with Flex 2.0 within that time.<br />
<span id="more-49"></span><br />
I had looked at the Flex 1.5 examples previously but never took a look at their implementation, I understand that there have been substantial changes between 1.5 &#038; 2.0 and the <a href="http://labs.macromedia.com/wiki/index.php/Flex_Builder">Flex Builder</a> alone is a beautiful example of the power of the <a href="http://www.eclipse.org/">Eclipse IDE</a>.</p>
<p>The power and simplicity of Flex itself is outstanding and I have 3 areas in mind at work where we could take advantage of Flex, combined with our existing Coldfusion domain models, and really see the benefits shine. Indeed I spent the following few days in work gushing about Flex 2.0 and all of it&#8217;s benefits, which luckily was contagious with my colleagues, I guess this post is simply a continuation of that.</p>
<p>All I can say is I can&#8217;t wait to get my hands on it for a full project, the potential of using Flex for a certain project that I have previously been apprehensive about has actually made me really excited about it.</p>]]></content:encoded>
			<wfw:commentRss>http://www.defusion.org.uk/archives/2006/04/28/well-flex-me/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Power of Coldfusion Extending Java Data Types</title>
		<link>http://www.defusion.org.uk/archives/2006/04/11/the-power-of-coldfusion-extending-java-data-types/</link>
		<comments>http://www.defusion.org.uk/archives/2006/04/11/the-power-of-coldfusion-extending-java-data-types/#comments</comments>
		<pubDate>Tue, 11 Apr 2006 16:28:55 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Coldfusion]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.defusion.org.uk/archives/2006/04/11/the-power-of-coldfusion-extending-java-data-types/</guid>
		<description><![CDATA[Just now I wanted to compare a couple of arrays in Coldfusion to ensure they were both exactly the same. I knew that CFCUnit had this functionality and I had even pottered through the code a while back to see how it was done and had noticed that it was doing actual.equals(expected) or something like [...]]]></description>
			<content:encoded><![CDATA[<p>Just now I wanted to compare a couple of arrays in Coldfusion to ensure they were both exactly the same. I knew that <a href="http://www.cfcunit.org/">CFCUnit</a> had this functionality and I had even pottered through the code a while back to see how it was done and had noticed that it was doing <span class="code">actual.equals(expected)</span> or something like that, where both actual and expected are the arrays to compare.<br />
<span id="more-48"></span><br />
I&#8217;d found this interesting first time round but didn&#8217;t think much more about it until now. So with my current task in hand I headed back to CFCUnit to make sure my eyes hadn&#8217;t deceived me and had another look; yes that is what is was doing and no there wasn&#8217;t any voodoo involved.</p>
<p>It hadn&#8217;t really occurred to me until that moment &#8211; and I&#8217;m not sure if I&#8217;ve ever read anything about this, but data types in Coldfusion extend Java data types; in the <a href="http://weblogs.macromedia.com/cantrell/archives/2003/07/how_to_snoop_on.cfm">case of arrays</a> that is <span class="code">java.util.Vectors</span>.</p>
<p>This gives us access to all the native methods that Java has available on those data types and for my requirement that meant the nice and simple way to ensure that two (Coldfusion) arrays <span class="code">arrayA.equals(arrayB)</span> are the same.</p>]]></content:encoded>
			<wfw:commentRss>http://www.defusion.org.uk/archives/2006/04/11/the-power-of-coldfusion-extending-java-data-types/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

