<?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>blog.eliotsykes.com &#187; Text</title>
	<atom:link href="http://blog.eliotsykes.com/category/text/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.eliotsykes.com</link>
	<description></description>
	<lastBuildDate>Sun, 22 Aug 2010 14:09:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Recommended random plugin for Rails (find_random)</title>
		<link>http://blog.eliotsykes.com/2009/07/08/recommended-random-plugin-for-rails-find_random/</link>
		<comments>http://blog.eliotsykes.com/2009/07/08/recommended-random-plugin-for-rails-find_random/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 07:24:58 +0000</pubDate>
		<dc:creator>Eliot</dc:creator>
				<category><![CDATA[Text]]></category>

		<guid isPermaLink="false">http://blog.eliotsykes.com/?p=213</guid>
		<description><![CDATA[find_random is a decent rails plugin that I&#8217;ve been using for a while now on Missed Connections that is very handy for finding random active records. The plugin author is Ben Tucker of Green River .  I&#8217;ve just emailed him in the hope he&#8217;ll add a couple of changes I submitted. find_random subversion repository: http://pub.svn.greenriver.org/find_random/ Update: [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.railslodge.com/plugins/964-find-random">find_random</a> is a decent rails plugin that I&#8217;ve been using for a while now on <a href="http://www.missedconnections.com/">Missed Connections</a> that is very handy for finding random active records.</p>
<p>The plugin author is Ben Tucker of <a href="http://www.greenriver.org/">Green River</a> .  I&#8217;ve just emailed him in the hope he&#8217;ll add a couple of changes I submitted.</p>
<p>find_random subversion repository: <a style="text-decoration: none;" href="http://pub.svn.greenriver.org/find_random/">http://pub.svn.greenriver.org/find_random/</a></p>
<p>Update: Heard back from Ben and <a href="http://github.com/btucker/find_random/commit/4fd947a84c82ccb26ad761f22664fd085db82d5b">he&#8217;s kindly merged in my changes</a> &#8211; thanks Ben!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.eliotsykes.com/2009/07/08/recommended-random-plugin-for-rails-find_random/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GMail has built-in Multiple Signatures (its called Canned Responses)</title>
		<link>http://blog.eliotsykes.com/2009/07/06/gmail-has-built-in-multiple-signatures-its-called-canned-responses/</link>
		<comments>http://blog.eliotsykes.com/2009/07/06/gmail-has-built-in-multiple-signatures-its-called-canned-responses/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 10:48:06 +0000</pubDate>
		<dc:creator>Eliot</dc:creator>
				<category><![CDATA[Text]]></category>

		<guid isPermaLink="false">http://blog.eliotsykes.com/?p=206</guid>
		<description><![CDATA[When looking to find a way to have multiple signatures in gmail, I found a lot of older blog posts talking about Firefox plugins, which aren&#8217;t great if you use multiple computers or a different browser. So anyway, there&#8217;s a better solution, works on all platforms and its built in to gmail. Go to the [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-210" title="Gmail" src="http://blog.eliotsykes.com/wp-content/uploads/2009/07/gmail.jpg" alt="Gmail" width="500" height="330" /></p>
<p>When looking to find a way to have multiple signatures in gmail, I found a lot of older blog posts talking about Firefox plugins, which aren&#8217;t great if you use multiple computers or a different browser.</p>
<p>So anyway, there&#8217;s a better solution, works on all platforms and its built in to gmail.</p>
<ul>
<li>Go to the Google Labs features in Gmail and enable &#8220;canned responses&#8221;.</li>
<li>Add your signatures to canned responses.  To add a canned response, &#8220;Compose&#8221; a new email, enter the signature you want, then just above the message text area use the &#8220;canned responses&#8221; drop down to save the signature.</li>
<li>Repeat above steps for every signature you want</li>
</ul>
<p><a title="Gmail" href="http://www.flickr.com/photos/oneras/2342993448/">Photo</a>: Thanks to <a href="http://www.flickr.com/people/oneras/">Mario</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.eliotsykes.com/2009/07/06/gmail-has-built-in-multiple-signatures-its-called-canned-responses/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Finding original free photos for your blog</title>
		<link>http://blog.eliotsykes.com/2009/06/30/finding-original-free-photos-for-your-blog/</link>
		<comments>http://blog.eliotsykes.com/2009/06/30/finding-original-free-photos-for-your-blog/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 07:08:51 +0000</pubDate>
		<dc:creator>Eliot</dc:creator>
				<category><![CDATA[Text]]></category>

		<guid isPermaLink="false">http://blog.eliotsykes.com/?p=199</guid>
		<description><![CDATA[Update 21/Dec/2009: I&#8217;m now using an easier method than this, Sprixi &#8211; see blog post or go to Sprixi A week-long feature of New York Missed Connections has begun over on the Missed Connections blog. For each post I&#8217;ll be using a photo with a Creative Commons license found on Flickr, although not all Flickr photos have [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/ucumari/3132833222/"><img class="alignnone size-full wp-image-200" title="Polar Bear" src="http://blog.eliotsykes.com/wp-content/uploads/2009/06/polar-bear.jpg" alt="Polar Bear" width="386" height="500" /></a></p>
<p><strong>Update 21/Dec/2009</strong>: I&#8217;m now using an easier method than this, <a href="http://www.sprixi.com/">Sprixi</a> &#8211; see <a href="http://blog.eliotsykes.com/2009/12/21/sprixinew-way-to-find-images-for-your-blog/">blog post</a> or <a href="http://www.sprixi.com/">go to Sprixi</a></p>
<p>A week-long feature of <a href="http://blog.missedconnections.com/?p=129">New York Missed Connections</a> has begun over on the <a title="Missed Connections blog" href="http://blog.missedconnections.com/">Missed Connections blog</a>.</p>
<p>For each post I&#8217;ll be using a photo with a Creative Commons license found on Flickr, although not all Flickr photos have the Creative Commons license.  To find the ones that do:</p>
<ol>
<li>Go to <a href="http://www.flickr.com/search/advanced/">Flickr Advanced Search</a></li>
<li>Enter the search terms and any other criteria you want</li>
<li><strong>To find Creative Commons licensed content:</strong> scroll down the page and be sure to check the box labelled &#8220;<label for="ccsearch">Only search within Creative Commons-licensed content</label> &#8220;.  There are some sub-checkboxes here you may also want to check depending on the intended use of the photo.</li>
<li>Click the search button</li>
</ol>
<p>Once you&#8217;ve got the results back, consider sorting by &#8220;Most interesting&#8221; so you see some of the best photos matching your search first.</p>
<p>Then, when you&#8217;ve clicked through to the photo you want, look towards the bottom of the right-hand column of the photo&#8217;s page for the &#8220;Additional Information&#8221; heading.  Underneath the heading there&#8217;ll be a &#8220;Some rights reserved&#8221; link, which you should click on to find the specific terms of the Creative Commons license the photographer has chosen for the photo.  If the photo&#8217;s license doesn&#8217;t jar with your intended use then you can use the photo, and bear in mind  you&#8217;ll normally need to attribute the photographer in the article you publish the photo &#8211; I suggest a link to the photo&#8217;s page on Flickr and a link to the photographer&#8217;s Flickr profile.</p>
<p>Finally, you might like to drop the photographer an e-mail or Flickr-mail as they&#8217;ll probably be interested in hearing how their photo is being used.</p>
<p>More about <a href="http://www.flickr.com/creativecommons/">Creative Commons licensed photos on Flickr</a>.</p>
<p>Photo: Thanks to <a href="http://www.flickr.com/people/ucumari/">Valerie</a> for making this <a title="Polar bear" href="http://www.flickr.com/photos/ucumari/3132833222/">amazing photo of a Polar Bear</a> available to the World</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.eliotsykes.com/2009/06/30/finding-original-free-photos-for-your-blog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MovieStinger.com and RunPee.com improve your cinema experience</title>
		<link>http://blog.eliotsykes.com/2009/06/17/moviestingercom-and-runpeecom-improve-your-cinema-experience/</link>
		<comments>http://blog.eliotsykes.com/2009/06/17/moviestingercom-and-runpeecom-improve-your-cinema-experience/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 07:34:28 +0000</pubDate>
		<dc:creator>Eliot</dc:creator>
				<category><![CDATA[Text]]></category>

		<guid isPermaLink="false">http://blog.eliotsykes.com/?p=195</guid>
		<description><![CDATA[Note to self: check these web sites before stepping into a movie &#8220;Post credits scene database&#8221; MovieStinger.com &#8220;Helping your bladder enjoy going to the movies as much as you do&#8221; RunPee.com Thanks to George Norman for this post]]></description>
			<content:encoded><![CDATA[<p>Note to self: check these web sites before stepping into a movie</p>
<p>&#8220;Post credits scene database&#8221; <a href="http://moviestinger.com/">MovieStinger.com</a></p>
<p>&#8220;Helping your bladder enjoy going to the movies as much as you do&#8221; <a href="http://runpee.com">RunPee.com</a></p>
<p>Thanks to George Norman for <a href="http://www.findmysoft.com/news/Useful-Web-Services-for-the-Moviegoer-Movie-Stinger/">this post</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.eliotsykes.com/2009/06/17/moviestingercom-and-runpeecom-improve-your-cinema-experience/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to move subversion subdirectory to its own repository</title>
		<link>http://blog.eliotsykes.com/2009/06/09/how-to-move-subversion-subdirectory-to-its-own-repository/</link>
		<comments>http://blog.eliotsykes.com/2009/06/09/how-to-move-subversion-subdirectory-to-its-own-repository/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 07:17:04 +0000</pubDate>
		<dc:creator>Eliot</dc:creator>
				<category><![CDATA[Text]]></category>

		<guid isPermaLink="false">http://blog.eliotsykes.com/?p=190</guid>
		<description><![CDATA[Thanks to Walter Reiner for his guide on moving a svn directory to a different repository, it helped me out this morning. Update: I couldn&#8217;t get this to work for me (svnadmin broken pipe on cygwin), I think its a problem with my setup rather than the instructions. As it is just a local filesystem [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to <a href="http://www.wreiner.at/en/about-me/">Walter Reiner</a> for his guide on<a href="http://www.wreiner.at/en/2009/02/25/svn-unterverzeichnis-von-einem-repository-in-ein-neues-verschiebensvn-howto-move-subdirectory-from-one-repository-to-another/"> moving a svn directory to a different repository</a>, it helped me out this morning.</p>
<p><strong>Update:</strong> I couldn&#8217;t get this to work for me (svnadmin broken pipe on cygwin), I think its a problem with my setup rather than the instructions.  As it is just a local filesystem repository with only my work in it, and life is short, I&#8217;ve decided to just do an svn export and import it into a new repository.  I&#8217;ll keep the old repository subdirectory kicking around for a while just in case I need the history.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.eliotsykes.com/2009/06/09/how-to-move-subversion-subdirectory-to-its-own-repository/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>100 Most Inspiring Movies</title>
		<link>http://blog.eliotsykes.com/2009/06/06/100-most-inspiring-movies/</link>
		<comments>http://blog.eliotsykes.com/2009/06/06/100-most-inspiring-movies/#comments</comments>
		<pubDate>Sat, 06 Jun 2009 19:27:59 +0000</pubDate>
		<dc:creator>Eliot</dc:creator>
				<category><![CDATA[Text]]></category>

		<guid isPermaLink="false">http://blog.eliotsykes.com/?p=183</guid>
		<description><![CDATA[Tonight I&#8217;m watching To Kill a Mockingbird, and so I wikipedia&#8217;d it and found out that it is 2nd in a list of America&#8217;s 100 most inspiring movies, as judged by the AFI in 2008.  The list is good reading for movie lovers. Here&#8217;s some interesting stats (copied from wikipedia) about the 300 movies from [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/To_Kill_a_Mockingbird_(film)"><img class="size-full wp-image-187 aligncenter" title="To kill a Mockingbird movie poster" src="http://blog.eliotsykes.com/wp-content/uploads/2009/06/to-kill-a-mockingbird.jpg" alt="To kill a Mockingbird movie poster" width="290" height="451" /></a></p>
<p>Tonight I&#8217;m watching <a href="http://en.wikipedia.org/wiki/To_Kill_a_Mockingbird_(film)">To Kill a Mockingbird</a>, and so I wikipedia&#8217;d it and found out that it is 2nd in a list of America&#8217;s 100 most inspiring movies, as judged by the AFI in 2008.  The list is good reading for movie lovers. Here&#8217;s some interesting stats (copied from wikipedia) about the 300 movies from the original ballot that the final 100 were selected from:</p>
<ul>
<li><a title="Tom Hanks" href="http://en.wikipedia.org/wiki/Tom_Hanks">Tom Hanks</a> and <a title="Henry Fonda" href="http://en.wikipedia.org/wiki/Henry_Fonda">Henry Fonda</a> are the two most represented actors, in eight nominated films each. <a title="Gary Cooper" href="http://en.wikipedia.org/wiki/Gary_Cooper">Gary Cooper</a> and <a title="Sidney Poitier" href="http://en.wikipedia.org/wiki/Sidney_Poitier">Sidney Poitier</a> each star in seven nominated films.</li>
<li><a title="James Stewart (actor)" href="http://en.wikipedia.org/wiki/James_Stewart_(actor)">James Stewart</a> played the main role in two out of the top five films (<em><a title="It's a Wonderful Life" href="http://en.wikipedia.org/wiki/It%27s_a_Wonderful_Life">It&#8217;s a Wonderful Life</a></em> and <em><a title="Mr. Smith Goes to Washington" href="http://en.wikipedia.org/wiki/Mr._Smith_Goes_to_Washington">Mr. Smith Goes to Washington</a></em>). He also starred in <em><a class="mw-redirect" title="The Spirit of St. Louis" href="http://en.wikipedia.org/wiki/The_Spirit_of_St._Louis">The Spirit of St. Louis</a></em> (#69).</li>
<li><a title="Jean Arthur" href="http://en.wikipedia.org/wiki/Jean_Arthur">Jean Arthur</a>, with four nominated films, is the most represented actress.</li>
</ul>
<p>Quoted from: <a href="http://en.wikipedia.org/wiki/AFI's_100_Years..._100_Cheers">AFI&#8217;s 100 Years&#8230; 100 Cheers</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.eliotsykes.com/2009/06/06/100-most-inspiring-movies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UserVoice vs. Get Satisfaction</title>
		<link>http://blog.eliotsykes.com/2009/06/05/uservoice-vs-get-satisfaction/</link>
		<comments>http://blog.eliotsykes.com/2009/06/05/uservoice-vs-get-satisfaction/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 21:00:01 +0000</pubDate>
		<dc:creator>Eliot</dc:creator>
				<category><![CDATA[Text]]></category>

		<guid isPermaLink="false">http://blog.eliotsykes.com/?p=176</guid>
		<description><![CDATA[Just been deciding what feedback doowhacky to use with Missed Connections. Clearly it came down to two of the main players, UserVoice and Get Satisfaction, with UserVoice taking the top spot, as it just has a better feel to it (although Get Satisfaction is very good) and according to the comments on this post by [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="size-full wp-image-178 aligncenter" title="UserVoice logo" src="http://blog.eliotsykes.com/wp-content/uploads/2009/06/uservoice-logo.jpg" alt="UserVoice logo" width="233" height="81" /><br />
<img class="size-full wp-image-179 aligncenter" title="Get Satisfaction Logo" src="http://blog.eliotsykes.com/wp-content/uploads/2009/06/getsatisfaction-logo.png" alt="Get Satisfaction Logo" width="280" height="75" /></p>
<p>Just been deciding what feedback doowhacky to use with <a href="http://www.missedconnections.com/">Missed Connections</a>.</p>
<p>Clearly it came down to two of the main players, <a href="http://uservoice.com">UserVoice</a> and <a href="http://getsatisfaction.com">Get Satisfaction</a>, with UserVoice taking the top spot, as it just has a better feel to it (although Get Satisfaction is very good) and according to the <a href="http://mashable.com/2008/08/13/customer-service-resources/">comments on this post</a> by <a href="http://mashable.com/author/doriano-carta/">Doriano Carta</a> (aka <a href="http://twitter.com/paisano">@paisano</a> whos tweets I&#8217;m a fan of, worth a follow) it generates more feedback and that&#8217;s the measure that sold me.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.eliotsykes.com/2009/06/05/uservoice-vs-get-satisfaction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Green Lantern movie gets green lit</title>
		<link>http://blog.eliotsykes.com/2009/06/03/green-lantern-move-gets-green-lit/</link>
		<comments>http://blog.eliotsykes.com/2009/06/03/green-lantern-move-gets-green-lit/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 08:41:45 +0000</pubDate>
		<dc:creator>Eliot</dc:creator>
				<category><![CDATA[Text]]></category>

		<guid isPermaLink="false">http://blog.eliotsykes.com/?p=171</guid>
		<description><![CDATA[Not really, I just got a kick out of writing green twice in a headline, but there is this fan-made trailer This give anyone else geekbumps? Originally seen at Nerdist]]></description>
			<content:encoded><![CDATA[<p>Not really, I just got a kick out of writing green twice in a headline, but there is this fan-made trailer</p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/_hTiRnqnvDs&#038;color1=0xb1b1b1&#038;color2=0xcfcfcf&#038;hl=en&#038;feature=player_embedded&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/_hTiRnqnvDs&#038;color1=0xb1b1b1&#038;color2=0xcfcfcf&#038;hl=en&#038;feature=player_embedded&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p>This give anyone else geekbumps?</p>
<p>Originally seen at <a href="http://www.nerdist.com/2009/05/nathan-fillion-as-green-lantern.html">Nerdist</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.eliotsykes.com/2009/06/03/green-lantern-move-gets-green-lit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Intention revealing naming &#8211; a real world example</title>
		<link>http://blog.eliotsykes.com/2009/05/23/intention-revealing-naming-a-real-world-example/</link>
		<comments>http://blog.eliotsykes.com/2009/05/23/intention-revealing-naming-a-real-world-example/#comments</comments>
		<pubDate>Sat, 23 May 2009 09:42:55 +0000</pubDate>
		<dc:creator>Eliot</dc:creator>
				<category><![CDATA[Text]]></category>

		<guid isPermaLink="false">http://blog.eliotsykes.com/?p=144</guid>
		<description><![CDATA[For anyone looking for a realistic example of intention revealing naming, I hope this requirement I encountered will help you out.  Here you&#8217;ll see 3 versions of the requirement in code, each one an improvement on the previous. Background I do some work for an online pharmacy.  Most of the products the pharmacy sells online [...]]]></description>
			<content:encoded><![CDATA[<p>For anyone looking for a realistic example of intention revealing naming, I hope this requirement I encountered will help you out.  Here you&#8217;ll see 3 versions of the requirement in code, each one an improvement on the previous.</p>
<p><strong>Background</strong></p>
<p>I do some work for an online pharmacy.  Most of the products the pharmacy sells online are available to be bought by anyone, however, there is a small set of prescription products for sale that are only available to certain customers.</p>
<p>A product can belong to any number of categories.  A category may be designated as a &#8220;prescription category&#8221;.  If a product belongs to a prescription category then the product is a prescription product.</p>
<p>For every product we track the quantity in stock.  If a product sells out then an &#8220;out of stock&#8221; message is shown to the customer and the &#8220;add to cart&#8221; link is removed.</p>
<p>Here&#8217;s an idea of the view code I started with:</p>
<pre>if (product.getQuantity() &lt; 1) {
  "Sorry this product is out of stock"
} else {
  "&lt;a href=...&gt;Add to cart&lt;/a&gt;"
}</pre>
<p><strong>New business requirement</strong><br />
If a prescription product sells out, then it can still be ordered by the customer.  The customer does not need to know that the product is out of stock as the pharmacy can now get it shipped to them in time.</p>
<p><strong>1st attempt at introducing requirement</strong><br />
We use the existing Product method &#8220;belongsToPrescriptionCategory()&#8221; to determine if this is a prescription product.</p>
<pre>if (product.getQuantity() &lt; 1
  &amp;&amp; !product.belongsToPrescriptionCategory()) {
  "Sorry this product is out of stock"
} else {
  "&lt;a href=...&gt;Add to cart&lt;/a&gt;"
}</pre>
<p>belongsToPrescriptionCategory() loops through each category the product belongs to and if it finds a prescription category then it returns true.  If none of its categories are prescription ones then false is returned.</p>
<p>1st attempt summary:  Its kind of clear what is going on here, but it could be clearer.  Worse is the potential for duplication.  If you need to perform this check elsewhere in the view then your code will become ugly.  You&#8217;re aiming for clear and elegant, hence your code ought to read like a story.</p>
<p><strong>2nd attempt</strong><br />
So we want the code to read like a story, how about this?</p>
<pre>if (product.isOutOfStock()
  &amp;&amp; !product.requiresPrescription()) {
  "Sorry this product is out of stock"
} else {
  "&lt;a href=...&gt;Add to cart&lt;/a&gt;"
}</pre>
<p>2 new methods have been introduced to Product:</p>
<pre>isOutOfStock() {
  return getQuantity() &lt; 1;
}

requiresPrescription() {
  return belongsToPrescriptionCategory();
}</pre>
<p>This last method demonstrates a useful technique that I rely upon: wrapping an existing method call with an intention revealing name (&#8216;requiresPrescription&#8217; is the intention revealing name).  Anyone reading the code for the first time will understand what is going on quicker than if I hadn&#8217;t done this.  Its also a help to me when I come back to read this code for the first time in a few months and have completely forgotten the purpose and reasons behind it.</p>
<p>2nd attempt summary: The code is no fairytale but it is an easier to read story.  We still have potential for needless duplication by having those 2 method calls in the if expression.</p>
<p><strong>Final attempt</strong></p>
<pre>if (product.showInShopAsOutOfStock()) {
  "Sorry this product is out of stock"
} else {
  "&lt;a href=...&gt;Add to cart&lt;/a&gt;"
}</pre>
<p>Product&#8217;s new methods:</p>
<pre>showInShopAsOutOfStock() {
  return isOutOfStock() &#038;&#038; showableInShopAsOutOfStock();
}

showableInShopAsOutOfStock() {
  return !neverShowInShopAsOutOfStock();
}

neverShowInShopAsOutOfStock() {
  return requiresPrescription();
}
</pre>
<p>3rd attempt summary: We&#8217;ve removed the excessive code from the view layer and have ended up with code who&#8217;s intention you know immediately the first time you read it.</p>
<p>That method name &#8220;showInShopAsOutOfStock()&#8221; tells you exactly what the purpose of that view code is.  If you need to know the business reasons behind why we show something as out of stock in the shop then you go and take a look at the new methods in the Product class.  Business reasons do not need to be explicit everywhere you want to test whether to show a product as out of stock in the shop.</p>
<p><strong>Summary</strong><br />
Intention revealing names make your code clear, they remove duplication, and make it quicker to add new requirements.  For example, suppose another new requirement came in that said I had to make it so all products that cost over £1000 should never be shown in the shop as out of stock, my first attempt would have me add to the neverShowInShopAsOutOfStock() method:</p>
<pre>
neverShowInShopAsOutOfStock() {
  return requiresPrescription() || getPriceInPounds() > 1000;
}
</pre>
<p>Simple right?  Remember long descriptive method names are a widely accepted practice and you may find it more fun than writing lots of comments to explain your code.  Paragraphs of comments can go stale quickly, descriptive method names tend to not.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.eliotsykes.com/2009/05/23/intention-revealing-naming-a-real-world-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Looking for a colour multifunction laser printer?</title>
		<link>http://blog.eliotsykes.com/2009/05/20/looking-for-a-colour-multifunction-laser-printer/</link>
		<comments>http://blog.eliotsykes.com/2009/05/20/looking-for-a-colour-multifunction-laser-printer/#comments</comments>
		<pubDate>Wed, 20 May 2009 12:46:32 +0000</pubDate>
		<dc:creator>Eliot</dc:creator>
				<category><![CDATA[Text]]></category>

		<guid isPermaLink="false">http://blog.eliotsykes.com/?p=138</guid>
		<description><![CDATA[I was, and I&#8217;ve just ordered one. This is it As far as I can tell by comparing specs the Dell 1235cn printer is this model rebadged (specifically the 3175-FN model, Samsung also do FW, F, and plain 3175 models, where the F stands for Fax, N for Networkable, and W for wireless). Although I [...]]]></description>
			<content:encoded><![CDATA[<p>I was, and I&#8217;ve just ordered one.</p>
<p>This is it</p>
<div class="wp-caption aligncenter" style="width: 290px"><a href="http://www.amazon.co.uk/Samsung-CLX-3175FN-Colour-Printer-Scanner/dp/B001D8SA5U/ref=pd_rhf_p_t_2"><img title="Samsung 3175" src="http://ecx.images-amazon.com/images/I/41fuG5bjXWL._SL500_AA280_.jpg" alt="Samsung CLX-3175FN All-in-One Colour Laser Printer, Copier, Scanner and Fax" width="280" height="280" /></a><p class="wp-caption-text">Samsung 3175-FN. I hope it fits in my flat</p></div>
<p>As far as I can tell by comparing specs the <a title="Dell 1235cn" href="http://www.dell.com/content/products/productdetails.aspx/printer-dell-1235cn?c=us&amp;cs=555&amp;l=en&amp;s=biz">Dell 1235cn</a> printer is this model rebadged (specifically the 3175-<strong>FN</strong> model, Samsung also do FW, F, and plain 3175 models, where the F stands for Fax, N for Networkable, and W for wireless).</p>
<div class="wp-caption aligncenter" style="width: 305px"><a href="http://www.dell.com/content/products/productdetails.aspx/printer-dell-1235cn?c=us&amp;cs=555&amp;l=en&amp;s=biz"><img title="Dell 1235cn. Look familiar?" src="http://i.dell.com/resize.aspx/printer-dell-1235cn-hero/295" alt="Dell 1235cn Multifunction Laser Printer" width="295" height="295" /></a><p class="wp-caption-text">Dell 1235cn. Look familiar?</p></div>
<p>Although I ordered from Amazon, a slightly better price was available from <a href="http://www.acerdirect.co.uk/Samsung_CLX-3175FN_Multifunction_Laser_Printer_CLX-3175FN/version.asp?PID=456">Acer Direct</a> .</p>
<p>The Dell is only slightly pricier but available with 2 years on site warranty from <a href="http://www.printerland.co.uk/acatalog/dell_1235.html">Printerland</a>, which seems like a very good deal.</p>
<p>If you want the plain Samsung 3175 model, the best price I could find was on Pixmania and it came in under £200 including VAT.</p>
<p>Remember all of this is only correct in my often wrong opinion and at time of writing.</p>
<p>Sites I used for price comparison were Froogle and Kelkoo.  Google ads also threw up some pretty good prices.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.eliotsykes.com/2009/05/20/looking-for-a-colour-multifunction-laser-printer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
