<?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; programming</title>
	<atom:link href="http://www.ur-ban.com/blog/category/programming/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>Please don&#8217;t let yourself go stale</title>
		<link>http://www.ur-ban.com/blog/2010/06/18/please-dont-let-yourself-go-stale/</link>
		<comments>http://www.ur-ban.com/blog/2010/06/18/please-dont-let-yourself-go-stale/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 13:41:35 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=1815</guid>
		<description><![CDATA[I&#8217;ve written before about the notion of developers going stale. Day in day out I see examples of ydiw, but not of the &#8220;You&#8217;ve made a mistake, let me fix that for you&#8221; nature, but more of the &#8220;The 80&#8242;s called, they want their program back&#8221; type. I can forgive bugs and mistakes, but I [...]]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter" src="http://images.ur-ban.com/galleryv2/d/16172-2/Thouhastwronglydoneit.png" alt="" width="550" height="459" /></p>
<p>I&#8217;ve written before about the notion of <a href="http://www.ur-ban.com/blog/2008/10/27/dont-be-a-dsl-aka-when-developers-go-stale/">developers going stale</a>. Day in day out I see examples of <a href="http://www.google.co.uk/images?client=safari&amp;rls=en&amp;q=your%20doing%20it%20wrong&amp;oe=UTF-8&amp;redir_esc=&amp;um=1&amp;ie=UTF-8&amp;source=og&amp;sa=N&amp;hl=en&amp;tab=wi">ydiw</a>, but not of the &#8220;You&#8217;ve made a mistake, let me fix that for you&#8221; nature, but more of the &#8220;The 80&#8242;s called, they want their program back&#8221; type. I can forgive bugs and mistakes, but I just find it very hard to not get annoyed with antiquated and long-winded ways of doing things, especially when there are far better/easier/quicker ways of achieving the same goals with other tools.</p>
<p>Burying your head in the sand about different techniques and technologies does no one any favours, especially yourself. You don&#8217;t need to learn each new shiny language in depth or even at all, but just reading a bit about it or even trying it out will propel your game so far ahead of the pack that you&#8217;d be foolish not to do it. Now maybe you don&#8217;t care, maybe you&#8217;re just not interested and that&#8217;s fine, it&#8217;s not for everyone, but then don&#8217;t make others suffer because of your laziness/lack of enthusiasm. I don&#8217;t come over to your house and shit in your living room, so please don&#8217;t do it in mine.</p>
<p>It just pains me so much when I see things being done wrong. You can call me a fanboi if you want, but I don&#8217;t simply bang the drum of the technology I use because I&#8217;ve been brainwashed, but because I&#8217;ve been where you are now and discovered something better. Now you can always ignore my advice, after you&#8217;ve investigated it yourself, but don&#8217;t just dismiss it out of hand. So many people make out like it&#8217;s such a great sacrifice to try other technologies. But how long would it really take to try something? Not even a few hours. You&#8217;re not willing to give up a couple of hours for potentially days and days of re-couped time? Get out of here!</p>
<p>Finally, if not for yourself, do it for your clients. Would you trust a doctor who used methods from the 15th century? No? Then why should your clients trust you if you&#8217;re still using crazy old ways to get stuff done.</p>
<p>So let&#8217;s make the world a better place and make my life easier at the same time. Right, I&#8217;m off to play with HTML5 and CSS3.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2010/06/18/please-dont-let-yourself-go-stale/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>It&#8217;s the polish that takes the longest</title>
		<link>http://www.ur-ban.com/blog/2010/06/11/its-the-polish-that-takes-the-longest/</link>
		<comments>http://www.ur-ban.com/blog/2010/06/11/its-the-polish-that-takes-the-longest/#comments</comments>
		<pubDate>Fri, 11 Jun 2010 13:22:16 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=1805</guid>
		<description><![CDATA[After spending a few hours in Photoshop trying to get some buttons to just look &#8220;right&#8221;, I started to think about how I seem to spend the majority of my time adding &#8220;polish&#8221; to applications. Getting features in is easy, getting them working nicely and looking great is hard. It&#8217;s the 80/20 principle, it&#8217;s that [...]]]></description>
			<content:encoded><![CDATA[<p>After spending a few hours in Photoshop trying to get some buttons to just look &#8220;right&#8221;, I started to think about how I seem to spend the majority of my time adding &#8220;polish&#8221; to applications. Getting features in is easy, getting them working nicely and looking great is hard. It&#8217;s the 80/20 principle, it&#8217;s that final 20% that makes the difference between good and great. Apple is the obvious choice of reference here when it comes to polish. Their products are polished to such a high degree, that can&#8217;t help but I wonder what percentage of time they spend getting it right over getting it done.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2010/06/11/its-the-polish-that-takes-the-longest/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>who.removed.me</title>
		<link>http://www.ur-ban.com/blog/2010/05/06/who-removed-me/</link>
		<comments>http://www.ur-ban.com/blog/2010/05/06/who-removed-me/#comments</comments>
		<pubDate>Thu, 06 May 2010 10:49:07 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[who.removed.me]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=1761</guid>
		<description><![CDATA[I had the worst tooth ache last Thursday so couldn&#8217;t sleep. So while being up for most of the night I thought I&#8217;d whip up a small app to track my Facebook friends using the new Facebook Graph API. I&#8217;m always curious to see who has removed me on Facebook, and now I can finally [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="aligncenter" src="http://images.ur-ban.com/galleryv2/d/16164-1/whoremovedme_001.png" alt="" width="550" height="393" /></p>
<p>I had the worst tooth ache last Thursday so couldn&#8217;t sleep. So while being up for most of the night I thought I&#8217;d whip up a small app to track my Facebook friends using the new Facebook Graph API. I&#8217;m always curious to see who has removed me on Facebook, and now I can finally see who has. Check it out here <a href="http://who.removed.me">http://who.removed.me</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2010/05/06/who-removed-me/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What we all need is understanding</title>
		<link>http://www.ur-ban.com/blog/2010/03/14/what-we-need-is-understanding/</link>
		<comments>http://www.ur-ban.com/blog/2010/03/14/what-we-need-is-understanding/#comments</comments>
		<pubDate>Sun, 14 Mar 2010 12:05:53 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[business]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=1629</guid>
		<description><![CDATA[There&#8217;s always that storyline in films and TV shows. Parents despair as they become more and more distant from their angst ridden teenage son/daughter who complains of just being mis-understood. There all the signs of neglect on the parents side, by not spending enough time/showing enough love, then there&#8217;s normally some sort of event that [...]]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">There&#8217;s always that storyline in films and TV shows. Parents despair as they become more and more distant from their angst ridden teenage son/daughter who complains of just being mis-understood. There all the signs of neglect on the parents side, by not spending enough time/showing enough love, then there&#8217;s normally some sort of event that brings them all together again to be one big happy family. Think John McClane in Die Hard and his daughter Lucy, or Sean Archer in Face/Off and his daughter Jamie. The parents and the teenager are living separate lives and there&#8217;s a clash when they come together, because neither understands where the other is coming from.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">As a developer one of the ways this problems often occurs is when working with people not from a technology background. Warren Buffett&#8217;s famous advice is to simply &#8220;Invest in what you understand.&#8221;. Many people take the time to understand their market, but do not take the time to understand the technology/process. It&#8217;s no surprise to me that the only company that I&#8217;ve worked for that&#8217;s actually achieved a measure of success is run by people who not only have a very clear understanding of their market, but also have a very clear understanding of the technology they provide. And what of the others that are no longer around? It&#8217;s no surprise I spent a lot of time at those places trying to explain how things worked and why things couldn&#8217;t be done. Yes, and while some businesses needs to be about pushing the boundaries and innovation, to do so also requires a knowledge of the limitations of what currently exists.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">I have been as guilty of this sin as everyone else. As a developer it&#8217;s very easy to take no interest in the customer side of things and care only about the technology, and perhaps to a degree this is an even worse situation to be in over having management that don&#8217;t understand technology. When this happens solutions that are unusable by anyone can end up being delivered. I know for a fact I have delivered plenty of products without ever asking myself who the product is actually aimed at, all the while being feature focused. Where as now, rather then only caring if something can be done or not, I try and ask myself who will be trying to achieve a task and what is the best way for them to go about doing so. As with anything, there is a balance that needs to be found.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Managers, understand the technology. Developers, understand the market.</div>
<p>There&#8217;s always that storyline in films and TV shows. Parents despair as they become more and more distant from their angst ridden teenage son/daughter who complains of just being mis-understood. There all the signs of neglect on the parents side, not spending time with them or not showing enough love. Then there&#8217;s normally some sort of horrible event that brings them all together again to be one big happy family and they all live happily ever after. Think John McClane in Die Hard and his daughter Lucy, or Sean Archer in Face/Off and his daughter Jamie. The parents and the teenager are living separate lives and there&#8217;s a clash when they come together because neither understands where the other is coming from.</p>
<p>As a developer this problems often occurs when working with people not from a technology background. Warren Buffett&#8217;s famous advice is to &#8220;Invest in what you understand.&#8221; and while many managers take the time to understand their market, they don&#8217;t take the time to understand the technology/processes of their business. It&#8217;s no surprise to me that the only company that I&#8217;ve worked for that&#8217;s actually achieved a measure of success is run by people who not only have a very clear understanding of their market, but who also have a very clear understanding of the technology they provide. What of the others that are no longer around? It&#8217;s no surprise I spent a lot of time at those places trying to explain how things worked and why things couldn&#8217;t be done. And while some businesses are about pushing the boundaries and innovating, to do so requires a knowledge of the limitations of what currently exists.</p>
<p>As a developer I have been as guilty of this sin as everyone else. It&#8217;s very easy to take no interest in the customer and to care only about the technology. Perhaps to a degree this is an even worse situation to be in over having management that don&#8217;t understand technology, as when this happens, solutions that are unusable by anyone are usually delivered. I know for a fact I have delivered plenty of products without ever asking myself who the product is actually aimed at, all the while being completely feature focused. When I think back to those products, it&#8217;s a wonder they survived any sort of usage at all. Now, rather then only caring if something can be done or not, I try and ask myself who will be trying to achieve a task and what is the best way for them to go about doing so. As with anything, there is a balance that needs to be found.</p>
<p>Managers, understand the technology. Developers, understand the market.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2010/03/14/what-we-need-is-understanding/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Broken Window Policy of Programming</title>
		<link>http://www.ur-ban.com/blog/2010/01/14/broken-window-policy-of-programming/</link>
		<comments>http://www.ur-ban.com/blog/2010/01/14/broken-window-policy-of-programming/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 14:54:43 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[bestpractice]]></category>

		<guid isPermaLink="false">http://www.ur-ban.com/blog/?p=1335</guid>
		<description><![CDATA[There comes a point in every software projects life where everything just feels wrong. No one wants to touch the code as it stinks and everyone working on the project just feels demotivated and would rather just go home then have to do anything more on it. On projects like this, when it comes to [...]]]></description>
			<content:encoded><![CDATA[<p>There comes a point in every software projects life where everything just feels wrong. No one wants to touch the code as it stinks and everyone working on the project just feels demotivated and would rather just go home then have to do anything more on it. On projects like this, when it comes to adding new features or bits of code, because everything else is such a mess, the changes are just hacked in rather than being properly thought out and coded up well.</p>
<p>We&#8217;ve all been there and the frustrating thing is that our opinion of the project, from good to bad, seems to happens over night. If you sit down and think back, you can probably pick out all the things that were just shoved in that eventually led to the project becoming a mess, but at the time we never chose to do anything about. It&#8217;s almost always a case of deferring better solutions or a round of refactoring to some point in the future. &#8220;I&#8217;ll knock this up now and come back to it later.&#8221;. The problem is that later never comes. This is the essence of technical debt. You may only go into debt by a fraction, but do it a few times and eventually all those fractions add up. Until one day when you go to check your balance, you find yourself swimming in the middle of the ocean with no land in sight.</p>
<p>Implementing a broken window policy can go a huge way towards keeping a project healthy. If there is a broken window (bad code) fix it as-soon-as-possible. It doesn&#8217;t have to be that instant (although if you can, you should), but fix it. Part of the policy also means trying not to break windows yourself. Write the best code you can, as often as you can. Set the benchmark of quality for the rest of the team, even if they don&#8217;t follow suit. The danger is that many people are very &#8220;me too&#8221; about things. &#8220;Well if such-and-such can do it like this, then so can I *hack* *hack* *hack*&#8221;. </p>
<p>Of course we all write crap from time to time. TBH most of the stuff I write is crap. But I honestly feel more motivated to work on code that&#8217;s been loved and looked after, rather than something that&#8217;s hanging together by a thread.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ur-ban.com/blog/2010/01/14/broken-window-policy-of-programming/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>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>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>
