<?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>Richard Hart &#124; Hates_ &#187; computing</title>
	<atom:link href="http://www.ur-ban.com/blog/category/computing/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ur-ban.com/blog</link>
	<description>Programming &#38; Life - ur-ban.com</description>
	<lastBuildDate>Wed, 30 Jun 2010 12:20:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Tagging in Notational Velocity</title>
		<link>http://www.ur-ban.com/blog/2010/03/18/tagging-in-notational-velocity/</link>
		<comments>http://www.ur-ban.com/blog/2010/03/18/tagging-in-notational-velocity/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 22:21:36 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[computing]]></category>
		<category><![CDATA[productivity]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=1750</guid>
		<description><![CDATA[Recently I switched from Evernote to Notational Velocity. I was so sick of the Evernote iPhone app and saw that Notational Velocity synced with Simplenote. Since trying them both out I haven&#8217;t looked back. Now, Notational Velocity supports tagging but Simplenote doesn&#8217;t, and as I like to search by tag, this was a bit of [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="alignnone" src="http://www.ur-ban.com/galleryv2/d/16145-1/notational_velocity_001.png" alt="" width="570" height="273" /></p>
<p>Recently I switched from Evernote to Notational Velocity. I was so sick of the Evernote iPhone app and saw that Notational Velocity synced with Simplenote. Since trying them both out I haven&#8217;t looked back. Now, Notational Velocity supports tagging but Simplenote doesn&#8217;t, and as I like to search by tag, this was a bit of a problem. So taking the Twitter approach, I simply hashtag my notes, which makes them incredibly easy to find in both Notational Velocity and Simplenote. I don&#8217;t put the hashtag in the name of the note but just as the first line. I found that putting the tag in the name looked a bit untidy in SimpleNote. A nice side effect is that in Simplenote, the tags appear as the preview line. Problem solved. #notationalvelocity #simplenote</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2010/03/18/tagging-in-notational-velocity/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Missing menubar icons in OSX 10.6.2</title>
		<link>http://www.ur-ban.com/blog/2009/11/11/missing-menubar-icons-in-osx-10-6-2/</link>
		<comments>http://www.ur-ban.com/blog/2009/11/11/missing-menubar-icons-in-osx-10-6-2/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 11:41:00 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[computing]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[osx]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=1238</guid>
		<description><![CDATA[A whole load of menubar icons disappeared after installing 10.6.2. Seems it&#8217;s a problem related to me doing a small hack in the past to disable Spotlight. Steven Seeger&#8217;s fix restored the menubar to it&#8217;s full glory. sudo mv /System/Library/CoreServices/Search.{bundle,bak} killall SystemUIServer]]></description>
			<content:encoded><![CDATA[<p>A whole load of menubar icons disappeared after installing 10.6.2. Seems it&#8217;s a problem related to me doing a small hack in the past to disable Spotlight. <a href="http://discussions.apple.com/thread.jspa?messageID=10558343">Steven Seeger&#8217;s fix</a> restored the menubar to it&#8217;s full glory.</p>
<pre><code>  sudo mv /System/Library/CoreServices/Search.{bundle,bak}
  killall SystemUIServer</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2009/11/11/missing-menubar-icons-in-osx-10-6-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Essential reading for developers</title>
		<link>http://www.ur-ban.com/blog/2009/11/08/essential-reading/</link>
		<comments>http://www.ur-ban.com/blog/2009/11/08/essential-reading/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 15:26:01 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[computing]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[books]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=1229</guid>
		<description><![CDATA[I&#8217;ve been meaning to write up a list of what books I think every developer, aspiring or seasoned should read. So let&#8217;s cut to the chase, and in no particular order: Code Complete If there was ever a bible for coding, this is it. It&#8217;s even Bible sized. A nice size to chuck at those [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been meaning to write up a list of what books I think every developer, aspiring or seasoned should read. So let&#8217;s cut to the chase, and in no particular order:</p>
<p style="text-align: center;"><img class="aligncenter" src="http://images.ur-ban.com/galleryv2/d/16120-1/code_complete.png" alt="" width="150" height="183" /></p>
<p><strong>Code Complete</strong><br />
If there was ever a bible for coding, this is it. It&#8217;s even Bible sized. A nice size to chuck at those annoying developers who just have no clue.</p>
<p style="text-align: center;"><img class="aligncenter" src="http://images.ur-ban.com/galleryv2/d/16118-1/clean_code.png" alt="" width="150" height="199" /></p>
<p><strong>Clean Code</strong><br />
I would consider this book the &#8220;Ten Commandments&#8221; of coding and compliments Code Complete very very very well. If Code Complete teaches you how to be a Christian, then Clean Code teaches you how to be Jesus.</p>
<p style="text-align: center;"><img class="aligncenter" src="http://images.ur-ban.com/galleryv2/d/16122-1/refactoring_to_patterns.png" alt="" width="150" height="202" /></p>
<p><strong>Refactoring to Patterns</strong><br />
What I love about this book is that it you learn the fundamentals of refactoring at the same time as design patterns. The GoF Design Patterns book is quite heavy going. The examples aren&#8217;t well laid out and can be confusing especially if you&#8217;re not familiar with SmallTalk The examples in refactoring to patterns all take pretty familiar real world bits of code and walk you through the process of refactoring them into sensible patterns.</p>
<p>Three books? Is that it? Yup. In my mind those are the only three books that are essential reading, no matter what form of development you do. If you even remotely care about coding, then go to Amazon now and buy these books. Read them and take a good long hard look at your own code. If on the other hand you feel &#8220;You can&#8217;t be bothered&#8221; to read, learn and improve, then why are you doing something you don&#8217;t love or care about? You&#8217;re in the wrong industry if you&#8217;re not prepared to take time, all the time, to learn new things. Once you&#8217;ve read those, then you&#8217;re ready to move onto more specialised books. Here are some of my other favourite development books from over the years:</p>
<p>The Productive Programmer<br />
The Art of Agile Development<br />
Practices of an Agile Developer<br />
Joel on Software<br />
Unix Power Tools<br />
Programming Perl<br />
Essential Java<br />
Well Grounded Rubyist<br />
Design Patterns in Ruby<br />
CSS Mastery<br />
Prioritizing Web Usability</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2009/11/08/essential-reading/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t use PHPMyAdmin. SSH tunnel instead.</title>
		<link>http://www.ur-ban.com/blog/2009/10/26/why-use-phpmyadmin-when-you-can-ssh/</link>
		<comments>http://www.ur-ban.com/blog/2009/10/26/why-use-phpmyadmin-when-you-can-ssh/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 21:10:36 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[computing]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=1202</guid>
		<description><![CDATA[If you&#8217;re still using phpMyAdmin to admin your remote database, then you&#8217;re doing it wrong. Don&#8217;t expose your database to the outside world like this, instead use a SSH tunnel. In your terminal simply create the tunnel: ssh -fNg -L 8888:127.0.0.1:3306 {your_username}@{yourdomain.com} Then in your MySQL interface of choice just connect to 127.0.0.1 port 8888 [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re still using phpMyAdmin to admin your remote database, then you&#8217;re doing it wrong. Don&#8217;t expose your database to the outside world like this, instead use a SSH tunnel. In your terminal simply create the tunnel:</p>
<pre class="textmate-source"><span class="source source_shell">  ssh -fNg -L 8888:127.0.0.1:3306 {your_username}@{yourdomain.com}</span></pre>
<p>Then in your MySQL interface of choice just connect to 127.0.0.1 port 8888 and voila, you&#8217;ll be connected to your remote database.</p>
<p style="text-align: center;"><img class="aligncenter" src="http://images.ur-ban.com/galleryv2/d/16112-1/ssh-tunnel-1.png" alt="" width="395" height="320" /></p>
<p>Apps like Querious even let you setup the connection internally without having to tunnel through in Terminal.</p>
<p style="text-align: center;"><img class="aligncenter" src="http://images.ur-ban.com/galleryv2/d/16116-1/ssh-tunnel-2.png" alt="" width="410" height="491" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2009/10/26/why-use-phpmyadmin-when-you-can-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Law of Demeter and the delegate method</title>
		<link>http://www.ur-ban.com/blog/2009/10/25/law-of-demeter-and-the-delegate-method/</link>
		<comments>http://www.ur-ban.com/blog/2009/10/25/law-of-demeter-and-the-delegate-method/#comments</comments>
		<pubDate>Sun, 25 Oct 2009 13:02:52 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[computing]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[bestpractice]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=1193</guid>
		<description><![CDATA[The Law of Demeter, or Principle of Least Knowledge is a fairly simple design pattern, which, simply put means that an object should only talk to it&#8217;s immediate &#8220;friends&#8221; The law states that a method M of and object O may only invoke the methods of the following kind: 1. a method on O itself [...]]]></description>
			<content:encoded><![CDATA[<p>The Law of Demeter, or Principle of Least Knowledge is a fairly simple design pattern, which, simply put means that an object should only talk to it&#8217;s immediate &#8220;friends&#8221;</p>
<p>The law states that a method M of and object O may only invoke the methods of the following kind:</p>
<p>1. a method on O itself<br />
2. any parameters passed to M<br />
3. any objects instantiated within M<br />
4. any direct components of O</p>
<p>The classic example coined by David Bock used a Paperboy (one object) delivering a paper, then extracting money from a Customer&#8217;s (another object) Wallet (and another):</p>
<pre class="textmate-source"><span class="source source_ruby"><span class="meta meta_class meta_class_ruby">  <span class="keyword keyword_control keyword_control_class keyword_control_class_ruby">class</span> <span class="entity entity_name entity_name_type entity_name_type_class entity_name_type_class_ruby">Paperboy</span></span>
    <span class="meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby"><span class="keyword keyword_control keyword_control_def keyword_control_def_ruby">def</span> <span class="entity entity_name entity_name_function entity_name_function_ruby">get_payment</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">(</span><span class="variable variable_parameter variable_parameter_function variable_parameter_function_ruby">customer</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">)</span></span>
      <span class="variable variable_language variable_language_ruby">self</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>money <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_augmented keyword_operator_assignment_augmented_ruby">+=</span> customer<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>wallet<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>take_out<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="constant constant_numeric constant_numeric_ruby">10</span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
    <span class="keyword keyword_control keyword_control_ruby">end</span>
  <span class="keyword keyword_control keyword_control_ruby">end</span></span></pre>
<p>In the &#8220;real world&#8221; the Paperboy would ask the customer for the money who would then take it out for them, rather then the Paperboy reaching into the customer&#8217;s back pocket and getting it for themself.</p>
<p>Really we want something as follows:</p>
<pre class="textmate-source"><span class="source source_ruby"><span class="meta meta_class meta_class_ruby">  <span class="keyword keyword_control keyword_control_class keyword_control_class_ruby">class</span> <span class="entity entity_name entity_name_type entity_name_type_class entity_name_type_class_ruby">Paperboy</span></span>
    <span class="meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby"><span class="keyword keyword_control keyword_control_def keyword_control_def_ruby">def</span> <span class="entity entity_name entity_name_function entity_name_function_ruby">get_payment</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">(</span><span class="variable variable_parameter variable_parameter_function variable_parameter_function_ruby">customer</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">)</span></span>
      <span class="variable variable_language variable_language_ruby">self</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>money <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_augmented keyword_operator_assignment_augmented_ruby">+=</span> customer<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>get_payment<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="constant constant_numeric constant_numeric_ruby">10</span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
    <span class="keyword keyword_control keyword_control_ruby">end</span>
  <span class="keyword keyword_control keyword_control_ruby">end</span>

<span class="meta meta_class meta_class_ruby">  <span class="keyword keyword_control keyword_control_class keyword_control_class_ruby">class</span> <span class="entity entity_name entity_name_type entity_name_type_class entity_name_type_class_ruby">Customer</span></span>
    <span class="meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby"><span class="keyword keyword_control keyword_control_def keyword_control_def_ruby">def</span> <span class="entity entity_name entity_name_function entity_name_function_ruby">get_payment</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">(</span><span class="variable variable_parameter variable_parameter_function variable_parameter_function_ruby">amount</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">)</span></span>
      wallet<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>take_out<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="constant constant_numeric constant_numeric_ruby">10</span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
    <span class="keyword keyword_control keyword_control_ruby">end</span>
  <span class="keyword keyword_control keyword_control_ruby">end</span></span></pre>
<p>This may all seem trivial and a waste of time, but what happens if some Customers want to pay by cheque? Those decisions should have an impact on the Paperboy, otherwise we end up with:</p>
<pre class="textmate-source"><span class="source source_ruby"><span class="meta meta_class meta_class_ruby">  <span class="keyword keyword_control keyword_control_class keyword_control_class_ruby">class</span> <span class="entity entity_name entity_name_type entity_name_type_class entity_name_type_class_ruby">Paperboy</span></span>
    <span class="meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby"><span class="keyword keyword_control keyword_control_def keyword_control_def_ruby">def</span> <span class="entity entity_name entity_name_function entity_name_function_ruby">get_payment</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">(</span><span class="variable variable_parameter variable_parameter_function variable_parameter_function_ruby">customer</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">)</span></span>
      <span class="keyword keyword_control keyword_control_ruby">if</span> customer<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>pay_by_cash?
        <span class="variable variable_language variable_language_ruby">self</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>money <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_augmented keyword_operator_assignment_augmented_ruby">+=</span> customer<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>wallet<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>take_out<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="constant constant_numeric constant_numeric_ruby">10</span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
      <span class="keyword keyword_control keyword_control_ruby">elsif</span> customer<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>pay_by_cheque?
        <span class="variable variable_language variable_language_ruby">self</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>money <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_augmented keyword_operator_assignment_augmented_ruby">+=</span> customer<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>cheque_book<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>write_cheque<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="constant constant_numeric constant_numeric_ruby">10</span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
      <span class="keyword keyword_control keyword_control_ruby">end</span>
    <span class="keyword keyword_control keyword_control_ruby">end</span>
  <span class="keyword keyword_control keyword_control_ruby">end</span></span></pre>
<p>Where as it makes more sense for the change to be contained within the Customer:</p>
<pre class="textmate-source"><span class="source source_ruby"><span class="meta meta_class meta_class_ruby">  <span class="keyword keyword_control keyword_control_class keyword_control_class_ruby">class</span> <span class="entity entity_name entity_name_type entity_name_type_class entity_name_type_class_ruby">Paperboy</span></span>
    <span class="meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby"><span class="keyword keyword_control keyword_control_def keyword_control_def_ruby">def</span> <span class="entity entity_name entity_name_function entity_name_function_ruby">get_payment</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">(</span><span class="variable variable_parameter variable_parameter_function variable_parameter_function_ruby">customer</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">)</span></span>
      <span class="variable variable_language variable_language_ruby">self</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>money <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_augmented keyword_operator_assignment_augmented_ruby">+=</span> customer<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>get_payment<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="constant constant_numeric constant_numeric_ruby">10</span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
    <span class="keyword keyword_control keyword_control_ruby">end</span>
  <span class="keyword keyword_control keyword_control_ruby">end</span>

<span class="meta meta_class meta_class_ruby">  <span class="keyword keyword_control keyword_control_class keyword_control_class_ruby">class</span> <span class="entity entity_name entity_name_type entity_name_type_class entity_name_type_class_ruby">Customer</span></span>
    <span class="meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby"><span class="keyword keyword_control keyword_control_def keyword_control_def_ruby">def</span> <span class="entity entity_name entity_name_function entity_name_function_ruby">get_payment</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">(</span><span class="variable variable_parameter variable_parameter_function variable_parameter_function_ruby">amount</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">)</span></span>
      <span class="keyword keyword_control keyword_control_ruby">if</span> pay_by_cash?
        wallet<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>take_out<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="constant constant_numeric constant_numeric_ruby">10</span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
      <span class="keyword keyword_control keyword_control_ruby">elsif</span> pay_by_cheque?
        cheque_book<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>write_cheque<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="constant constant_numeric constant_numeric_ruby">10</span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
      <span class="keyword keyword_control keyword_control_ruby">end</span>
    <span class="keyword keyword_control keyword_control_ruby">end</span>
  <span class="keyword keyword_control keyword_control_ruby">end</span></span></pre>
<p>So what does this have to do with Rails and the delegate method? The delegate method adds a quick and simple way of following the Law of Demeter without having to do very much at all.</p>
<pre class="textmate-source"><span class="source source_ruby"><span class="meta meta_class meta_class_ruby">  <span class="keyword keyword_control keyword_control_class keyword_control_class_ruby">class</span> <span class="entity entity_name entity_name_type entity_name_type_class entity_name_type_class_ruby">Order</span></span>
    belongs_to <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>customer</span>
  <span class="keyword keyword_control keyword_control_ruby">end</span>

<span class="meta meta_class meta_class_ruby">  <span class="keyword keyword_control keyword_control_class keyword_control_class_ruby">class</span> <span class="entity entity_name entity_name_type entity_name_type_class entity_name_type_class_ruby">Customer</span></span>
    has_many <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>orders</span>
    has_one <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>credit_card</span>
    has_one <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>bank_account</span>

    <span class="meta meta_function meta_function_method meta_function_method_without-arguments meta_function_method_without-arguments_ruby"><span class="keyword keyword_control keyword_control_def keyword_control_def_ruby">def</span> <span class="entity entity_name entity_name_function entity_name_function_ruby">payment_method</span></span>
      <span class="keyword keyword_control keyword_control_ruby">if</span> pay_by_card?
        credit_card
      <span class="keyword keyword_control keyword_control_ruby">elsif</span> pay_by_account?
        bank_account
      <span class="keyword keyword_control keyword_control_ruby">end</span>
    <span class="keyword keyword_control keyword_control_ruby">end</span>
  <span class="keyword keyword_control keyword_control_ruby">end</span>

<span class="meta meta_class meta_class_ruby">  <span class="keyword keyword_control keyword_control_class keyword_control_class_ruby">class</span> <span class="entity entity_name entity_name_type entity_name_type_class entity_name_type_class_ruby">CreditCard</span></span>
    belongs_to <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>customer</span>
  <span class="keyword keyword_control keyword_control_ruby">end</span>

<span class="meta meta_class meta_class_ruby">  <span class="keyword keyword_control keyword_control_class keyword_control_class_ruby">class</span> <span class="entity entity_name entity_name_type entity_name_type_class entity_name_type_class_ruby">BankAccount</span></span>
    belongs_to <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>customer</span>
  <span class="keyword keyword_control keyword_control_ruby">end</span></span></pre>
<p>This setup means to get an Order&#8217;s payment we would have to say:</p>
<pre class="textmate-source"><span class="source source_ruby">  <span class="variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_ruby">@</span>order</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>customer<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>payment_method<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>withdraw<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>amount<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span></span></pre>
<p>But if we simply change our objects as such:</p>
<pre class="textmate-source"><span class="source source_ruby"><span class="meta meta_class meta_class_ruby">  <span class="keyword keyword_control keyword_control_class keyword_control_class_ruby">class</span> <span class="entity entity_name entity_name_type entity_name_type_class entity_name_type_class_ruby">Order</span></span>
    belongs_to <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>customer</span>
    delegate <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>withdraw_payment</span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>to</span> <span class="punctuation punctuation_separator punctuation_separator_key-value">=&gt;</span> <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>customer</span>
  <span class="keyword keyword_control keyword_control_ruby">end</span>

<span class="meta meta_class meta_class_ruby">  <span class="keyword keyword_control keyword_control_class keyword_control_class_ruby">class</span> <span class="entity entity_name entity_name_type entity_name_type_class entity_name_type_class_ruby">Customer</span></span>
    has_many <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>orders</span>
    has_one <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>credit_card</span>
    has_one <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>bank_account</span>

    <span class="meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby"><span class="keyword keyword_control keyword_control_def keyword_control_def_ruby">def</span> <span class="entity entity_name entity_name_function entity_name_function_ruby">withdraw_payment</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">(</span><span class="variable variable_parameter variable_parameter_function variable_parameter_function_ruby">amount</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">)</span></span>
      <span class="keyword keyword_control keyword_control_ruby">if</span> pay_by_card?
        credit_card<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>withdraw<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>amount<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
      <span class="keyword keyword_control keyword_control_ruby">elsif</span> pay_by_account?
        bank_account<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>withdraw<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>amount<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
      <span class="keyword keyword_control keyword_control_ruby">end</span>
    <span class="keyword keyword_control keyword_control_ruby">end</span>
  <span class="keyword keyword_control keyword_control_ruby">end</span></span></pre>
<p>Now all we have to say is:</p>
<pre class="textmate-source"><span class="source source_ruby">  <span class="variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_ruby">@</span>order</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>withdraw_payment<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>amount<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span></span></pre>
<p>So at any time, the details of how a payment  is to be decided can be contained with the Customer. This is of course a simplistic example, but hopefully explains how you chould be using this handy feature.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2009/10/25/law-of-demeter-and-the-delegate-method/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>From TextMate to Vim</title>
		<link>http://www.ur-ban.com/blog/2009/10/24/from-textmate-to-vim/</link>
		<comments>http://www.ur-ban.com/blog/2009/10/24/from-textmate-to-vim/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 16:00:43 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[computing]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[textmate]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=1179</guid>
		<description><![CDATA[I&#8217;ve finally done it. After months and months of on-off usage of Vim, I&#8217;m now finally using it 100% of the time. It&#8217;s been a long and hard road getting here, but let me tell you, it&#8217;s been well worth it. I now feel like I absolutely fly through my code. I&#8217;ve read many a [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="aligncenter" src="http://images.ur-ban.com/galleryv2/d/16110-1/vim.png" alt="" width="550" height="352" /></p>
<p>I&#8217;ve finally done it. After months and months of on-off usage of Vim, I&#8217;m now finally using it 100% of the time. It&#8217;s been a long and hard road getting here, but let me tell you, it&#8217;s been well worth it. I now feel like I absolutely fly through my code. I&#8217;ve read many a time, people saying that watching someone using Vim is like watching something mystical, and I can see why. Looking at how I edit code in Vim now, makes me feel clumsy when I think back to using other editors like TextMate. Don&#8217;t get me wrong, TextMate is a wonderful editor, but there is just something about the speed and finesse of editing in Vim which I have just fallen in love with.</p>
<p>I wrote about trying MacVim before and how I just felt it lacked the spit and polish that TextMate does. But now, I can&#8217;t remember why I originally felt that way. There&#8217;s a simple elegance to the Vim, yet with this awesome power available to you. Switching wasn&#8217;t easy in the slightest. I would load Vim up for an hour, tinker around, get frustrated and go back to Textmate. Then a month later I&#8217;d try again, learn a new command, last two hours and go back to TextMate. A few more months and hours turned into a full day, then the full day turned into a couple of days, and then I never looked back.</p>
<p>One of the keys to hitting the ground running is having a good config. I originally used <a href="http://github.com/jferris/config_files">jferris</a>&#8216;s vimfiles but moved to <a href="http://github.com/scrooloose/vimfiles">scrooloose&#8217;s</a> files not long ago. It practically has every plugin you could ever need to make life in Vim sublime.</p>
<p>Some other handy references I&#8217;ve used along the way have been vimtutor, the Vim Recipies Cookbook, the Vim Tips Wiki. To aid my own memory of useful commands I&#8217;ve even started my own <a href="http://vimstuff.tumblr.com/">Vim tumblr</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2009/10/24/from-textmate-to-vim/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Skype on OSX</title>
		<link>http://www.ur-ban.com/blog/2009/10/04/skype-on-osx/</link>
		<comments>http://www.ur-ban.com/blog/2009/10/04/skype-on-osx/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 00:11:22 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[annoyances]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[applications]]></category>
		<category><![CDATA[design]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=1172</guid>
		<description><![CDATA[There&#8217;s just something about the way Skype looks on OSX that really bugs me. I can&#8217;t tell what it is, but the UI just feels really intrusive. Then again, it&#8217;s probably not supposed to be kept visible like I do with my contact list in Adium, which has a brilliant transparent and borderless option.]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="aligncenter" src="http://images.ur-ban.com/galleryv2/d/16108-1/skype.png" alt="" width="252" height="308" /></p>
<p>There&#8217;s just something about the way Skype looks on OSX that really bugs me. I can&#8217;t tell what it is, but the UI just feels really intrusive. Then again, it&#8217;s probably not supposed to be kept visible like I do with my contact list in Adium, which has a brilliant transparent and borderless option.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2009/10/04/skype-on-osx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vlad 2.0 Not Finding Tasks in deploy.rb</title>
		<link>http://www.ur-ban.com/blog/2009/09/15/vlad-2-0-not-finding-tasks-in-deploy-rb/</link>
		<comments>http://www.ur-ban.com/blog/2009/09/15/vlad-2-0-not-finding-tasks-in-deploy-rb/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 17:50:55 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[computing]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=1142</guid>
		<description><![CDATA[When I restalled all my gems on Snow Leopard, vlad refused to find any of the tasks I had defined in my deploy.rb. I thought this was a SL issue but turned out a week before it&#8217;s release Vlad had been updated to version 2 which used a new plugin system. Looking for vlad rake [...]]]></description>
			<content:encoded><![CDATA[<p>When I restalled all my gems on Snow Leopard, vlad refused to find any of the tasks I had defined in my deploy.rb. I thought this was a SL issue but turned out a week before it&#8217;s release Vlad had been updated to version 2 which used a new plugin system. Looking for vlad rake tasks returned an error:</p>
<pre class="textmate-source"><span class="text text_plain"><span class="meta meta_paragraph meta_paragraph_text">  >> rake -T vlad
  Could not load vlad: no such file to load -- vlad/git</span></span></pre>
<p>To solve the problem just required an install of the new vlad-git gem.</p>
<pre class="textmate-source"><span class="text text_plain"><span class="meta meta_paragraph meta_paragraph_text">  >> sudo gem install vlad-git</span></span></pre>
<p>Now all my tasks were appearing properly. Vlad 2 always brought around a few changes in it&#8217;s deploy.rb and use. Here is my deploy.rb for reference:</p>
<pre class="textmate-source"><span class="source source_ruby source_ruby_rails">  set <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>application</span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>yourdomain<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>
  set <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>domain</span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>yourdomain@yourdomain.com<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>

  set <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>user</span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>yourdomain<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>
  set <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>repository</span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>git@github.com:youraccount/yourdomain.git<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>

  task <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>staging</span> <span class="keyword keyword_control keyword_control_start-block keyword_control_start-block_ruby">do
</span>    set <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>revision</span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>origin/staging<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>
    set <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>deploy_to</span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>/opt/yourdomain.staging/<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>
  <span class="keyword keyword_control keyword_control_ruby">end</span>   

  task <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>production</span> <span class="keyword keyword_control keyword_control_start-block keyword_control_start-block_ruby">do
</span>    set <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>revision</span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>origin/master<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>
    set <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>deploy_to</span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>/opt/yourdomain/<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>
  <span class="keyword keyword_control keyword_control_ruby">end</span>

  namespace <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>vlad</span> <span class="keyword keyword_control keyword_control_start-block keyword_control_start-block_ruby">do
</span>
    desc <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>Pull from git, run migrations, then (re)start the app server<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>
    task <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>migrate_deploy</span> <span class="punctuation punctuation_separator punctuation_separator_key-value">=&gt;</span> <span class="punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby">[</span><span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>update</span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>migrate</span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>start_app</span><span class="punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby">]</span>

    desc <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>Pull from git then (re)start the app server<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>
    task <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>deploy</span> <span class="punctuation punctuation_separator punctuation_separator_key-value">=&gt;</span> <span class="punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby">[</span><span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>update</span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>start_app</span><span class="punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby">]</span>

    desc <span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>Restart Passenger<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span>
    remote_task <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>restart</span> <span class="keyword keyword_control keyword_control_start-block keyword_control_start-block_ruby">do
</span>      puts <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>Touching: <span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span>deploy_to<span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">}</span></span>current/tmp/restart.txt<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>
      run <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>touch <span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span>deploy_to<span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">}</span></span>/current/tmp/restart.txt<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>
    <span class="keyword keyword_control keyword_control_ruby">end</span>

  <span class="keyword keyword_control keyword_control_ruby">end</span>
</span></pre>
<p>Now invoking Vlad for my staging environment works as such:</p>
<pre class="textmate-source"><span class="text text_plain"><span class="meta meta_paragraph meta_paragraph_text">  >> rake staging vlad:deploy</span></span></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2009/09/15/vlad-2-0-not-finding-tasks-in-deploy-rb/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Code Shall Set You Free</title>
		<link>http://www.ur-ban.com/blog/2009/09/06/the-code-shall-set-you-free/</link>
		<comments>http://www.ur-ban.com/blog/2009/09/06/the-code-shall-set-you-free/#comments</comments>
		<pubDate>Sun, 06 Sep 2009 01:38:26 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[computing]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[bestpractice]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=1130</guid>
		<description><![CDATA[I was recently asked why I don&#8217;t comment my code. It&#8217;s a fair enough question. There was a time when commenting your code was the done thing. I was once a great believer in commenting code as much as possible and would bash those that didn&#8217;t, but now I vary rarely comment my code at [...]]]></description>
			<content:encoded><![CDATA[<div style="text-align: center;"><img class="alignnone" src="http://images.ur-ban.com/galleryv2/d/16100-1/commenting_code.png" alt="" width="461" height="276" /></div>
<p>I was recently asked why I don&#8217;t comment my code. It&#8217;s a fair enough question. There was a time when commenting your code was the done thing. I was once a great believer in commenting code as much as possible and would bash those that didn&#8217;t, but now I vary rarely comment my code at all. In my current project of over 1,500 LOC, there are only a handful of comments. Many people will argue this is irresponsible. Well how is anyone supposed to pick up and understand my code, if it&#8217;s not commented?</p>
<p>The code should comment itself.</p>
<p>That just sounds silly. It&#8217;s like saying a car should drive itself. But it can be done. A lot of this change of heart about comments has come from my commitment to becoming a better developer and spending countless hours reading about the practice of great development, which is something I&#8217;ve written about in the <a href="http://www.ur-ban.com/blog/2008/12/01/its-an-improvement-adventure/">past</a>. I&#8217;m a big believer that most of the time if you need to comment a piece of code, then it&#8217;s either bad code or too complicated. Of course that&#8217;s not true 100% of the time, but for the other 99% it really is. There are cases where things need to be explained and especially warned of, but a lot of the time, commenting is just an easy escape from having to do &#8220;proper&#8221; coding. It took me years and years to get a basic understanding of proper OO and I&#8217;ve still got a long way to go to reaching Journeyman levels of understanding, but I would always create large objects with huge and complex methods, when really what I needed were more concise classes with more responsibility for what they should be able to do. It&#8217;s not object orientated when you&#8217;re focus is on the method and not the class.</p>
<p>A simple example of commented code:</p>
<pre class="textmate-source"><span class="source source_ruby"><span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby">  <span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span> Feed the fish.
</span>  <span class="meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby"><span class="keyword keyword_control keyword_control_def keyword_control_def_ruby">def</span> <span class="entity entity_name entity_name_function entity_name_function_ruby">check_food</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">(</span><span class="variable variable_parameter variable_parameter_function variable_parameter_function_ruby">food</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">)</span></span>
<span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby">     <span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span> Check if Fish has eaten more then 5 hours ago.
</span>     <span class="keyword keyword_control keyword_control_ruby">if</span> <span class="variable variable_language variable_language_ruby">self</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>last_meal_time <span class="keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby">&lt;</span> <span class="constant constant_numeric constant_numeric_ruby">5</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>hours<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>ago
       <span class="keyword keyword_control keyword_control_pseudo-method keyword_control_pseudo-method_ruby">return</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>Not hungry<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>
<span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby">     <span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span> Check if the Fish eats this food.
</span>     <span class="keyword keyword_control keyword_control_ruby">elsif</span> <span class="keyword keyword_operator keyword_operator_logical keyword_operator_logical_ruby">!</span><span class="variable variable_language variable_language_ruby">self</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>edible_foods<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>contains?<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>food<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
       <span class="keyword keyword_control keyword_control_pseudo-method keyword_control_pseudo-method_ruby">return</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>Can't eat that!<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>
<span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby">     <span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span> Make sure the fish isn't being underfed.
</span>     <span class="keyword keyword_control keyword_control_ruby">elsif</span> food<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>amount <span class="keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby">&lt;</span>  fish_feeding_amount<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="variable variable_language variable_language_ruby">self</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>type<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
       <span class="keyword keyword_control keyword_control_pseudo-method keyword_control_pseudo-method_ruby">return</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>Not enough food.<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>
<span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby">     <span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span> Make sure the fish isn't being over fed.
</span>     <span class="keyword keyword_control keyword_control_ruby">elsif</span> food<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>amount <span class="keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby">&gt;</span> fish_feeding_amount<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="variable variable_language variable_language_ruby">self</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>type<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
       <span class="keyword keyword_control keyword_control_pseudo-method keyword_control_pseudo-method_ruby">return</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>Too much food.<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>
     <span class="keyword keyword_control keyword_control_ruby">end</span>
<span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby">     <span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span> Eat food.
</span>     <span class="variable variable_language variable_language_ruby">self</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>eat<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>food<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
  <span class="keyword keyword_control keyword_control_ruby">end</span></span></pre>
<p>Most comments can be done away with. If we split out functionality into more concise bits, then just reading the code should explain what&#8217;s happening better:</p>
<pre class="textmate-source"><span class="source source_ruby">  <span class="meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby"><span class="keyword keyword_control keyword_control_def keyword_control_def_ruby">def</span> <span class="entity entity_name entity_name_function entity_name_function_ruby">feed</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">(</span><span class="variable variable_parameter variable_parameter_function variable_parameter_function_ruby">food</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">)</span></span>
    <span class="keyword keyword_control keyword_control_pseudo-method keyword_control_pseudo-method_ruby">return</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>Not Hungry<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span> <span class="keyword keyword_control keyword_control_ruby">if</span> <span class="variable variable_language variable_language_ruby">self</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>recently_eaten?
    <span class="keyword keyword_control keyword_control_pseudo-method keyword_control_pseudo-method_ruby">return</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>Can't eat that!<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span> <span class="keyword keyword_control keyword_control_ruby">if</span> <span class="variable variable_language variable_language_ruby">self</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>does_not_eat?<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>food<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
    <span class="keyword keyword_control keyword_control_pseudo-method keyword_control_pseudo-method_ruby">return</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>Not Enough food<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span> <span class="keyword keyword_control keyword_control_ruby">if</span> <span class="variable variable_language variable_language_ruby">self</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>not_enough_food?<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>food<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
    <span class="keyword keyword_control keyword_control_pseudo-method keyword_control_pseudo-method_ruby">return</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>Too much food<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span> <span class="keyword keyword_control keyword_control_ruby">if</span> <span class="keyword keyword_operator keyword_operator_logical keyword_operator_logical_ruby">!</span><span class="variable variable_language variable_language_ruby">self</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>too_much_food?<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>food<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
    <span class="variable variable_language variable_language_ruby">self</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>eat<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>food<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
  <span class="keyword keyword_control keyword_control_ruby">end</span></span></pre>
<p>This isn&#8217;t a great example as once again the validation of whether the food can/will be eaten should move into it&#8217;s own method or class ever. If we&#8217;re follow Uncle Bob&#8217;s SOLID principles, the above examples breaks the OCP (Open Closed Principle) where entities should be open to extension and closed to modification. If more validation rules were needed, then that would require the code to be modified.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2009/09/06/the-code-shall-set-you-free/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gist</title>
		<link>http://www.ur-ban.com/blog/2009/08/21/gist/</link>
		<comments>http://www.ur-ban.com/blog/2009/08/21/gist/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 16:42:37 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[computing]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=1114</guid>
		<description><![CDATA[Great find by andhapp.]]></description>
			<content:encoded><![CDATA[<script src="http://gist.github.com/172116.js"></script>
<p>Great find by <a href="http://www.andhapp.com/blog/2009/08/20/gist-in-your-blog/">andhapp</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2009/08/21/gist/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
