<?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>XMLHead</title>
	<atom:link href="http://www.xmlhead.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.xmlhead.com</link>
	<description>Technical articles for web developers</description>
	<lastBuildDate>Sat, 20 Nov 2010 10:29:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Drinking the Rails Kool-Aide, Revisited</title>
		<link>http://www.xmlhead.com/archives/9</link>
		<comments>http://www.xmlhead.com/archives/9#comments</comments>
		<pubDate>Sat, 20 Nov 2010 10:27:20 +0000</pubDate>
		<dc:creator>Jim Nicholson</dc:creator>
				<category><![CDATA[agile]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.xmlhead.com/?p=9</guid>
		<description><![CDATA[A few years ago, I jotted down some thoughts about working with Rails in an Agile environment, under the somewhat provocative title I&#8217;ve used for this post. Here are some of those ideas. I&#8217;ve expanded on some, commented and clarified others. By no means an exhaustive list, here are some of the paradigms I&#8217;ve used [...]]]></description>
			<content:encoded><![CDATA[<p>A few years ago, I jotted down some thoughts about working with Rails in an Agile environment, under the somewhat provocative title I&#8217;ve used for this post. Here are some of those ideas. I&#8217;ve expanded on some, commented and clarified others. By no means an exhaustive list, here are some of the paradigms I&#8217;ve used when developing with Rails:</p>
<ol>
<li><strong>Embrace change.</strong> Forget how you did it before. Reproduce the results, not the methodology.</li>
<li><strong>Embrace design.</strong> Accept that the two primary work areas for a development project are architecture and data modeling. 80% of your project effort should be in these areas. <strong>Not</strong> coding. </li>
<li><strong>Design from square one.</strong> Don&#8217;t start by coding. Start with architecture. Model your database on a whiteboard. When you have the architecture where you think it should be, write tests. Coding too much too early will hamper success. If you can&#8217;t explain where you&#8217;re going, how can you know when you&#8217;ve arrived?</li>
<li><strong>Databases are for data.</strong> If you have data to store, put it in the database. If you need data, get it out of the database. Flat files in the file system are almost never what you want in a web application. </li>
<li><strong>Understand the framework&#8217;s inherent biases</strong>. For example, Rails doesn&#8217;t play well with certain concepts that are <em>de rigueur</em> in the database world, like domain keys, composite keys (although there&#8217;s a plugin for that), etc. There&#8217;s a longer post in this one, I think.</li>
<li><strong>Embrace DRY.</strong> When you do code, embrace &#8220;don&#8217;t repeat yourself&#8221; and be draconian about it. Don&#8217;t program via cut-and-paste.</li>
<li><strong>Leverage the community,</strong> or, to put it another way, <strong>Don&#8217;t Repeat Others Either.</strong> The initial thought when sitting down to code should be &#8220;where do I look for something already written that does what I want?&#8221; rather than &#8220;how am I going to do this?&#8221;</li>
<li><strong>Test everything</strong>. Don&#8217;t ship code for which you haven&#8217;t written formal tests.</li>
<li><strong>Don&#8217;t optimize the framework away.</strong> Optimization efforts should start with &#8220;How do I leverage the framework, given the overhead that I&#8217;ve paid already?&#8221; Worry about reducing the overhead only after you&#8217;ve gotten everything you can out of the framework.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.xmlhead.com/archives/9/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Capistrano deployment woes</title>
		<link>http://www.xmlhead.com/archives/6</link>
		<comments>http://www.xmlhead.com/archives/6#comments</comments>
		<pubDate>Wed, 27 Oct 2010 00:55:18 +0000</pubDate>
		<dc:creator>Jim Nicholson</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.xmlhead.com/?p=6</guid>
		<description><![CDATA[Deploying via Capistrano is supposed to be painless. Unfortunately, the Dreamhost Wiki entry on it gives an approach that doesn&#8217;t work for me. Specifically, I either timeout or get a connection refused on the connect. I have public key authentication working. I can ssh to the account from the shell prompt and not be asked [...]]]></description>
			<content:encoded><![CDATA[<p>Deploying via <a href="http://github.com/capistrano/capistrano/wiki/Documentation-v2.x">Capistrano</a> is supposed to be painless.  Unfortunately, the <a href="http://wiki.dreamhost.com/Capistrano">Dreamhost Wiki</a> entry on it gives an approach that doesn&#8217;t work for me.</p>
<p>Specifically, I either timeout or get a connection refused on the connect. </p>
<p>I have public key authentication working. I can ssh to the account from the shell prompt and not be asked for a password. </p>
<p>I also know that it&#8217;s not a problem with <a href="http://net-ssh.rubyforge.org/ssh/v2/api/index.html">Net::SSH</a>, because hand-tooling the connection from irb works: </p>
<pre class="brush:ruby">
require 'net/ssh'
Net::SSH.start('www.drinkingfromthefirehydrant.com','hydrant',:keys => %w(/Users/jnich/.ssh/id_dsa)) do |ssh|
    output = ssh.exec!("hostname")
    puts output
end
</pre>
<p>My config file looks like this:</p>
<pre class="brush:ruby">
set :user, 'hydrant'
role :app, "www.drinkingfromthefirehydrant.com"
ssh_options[:keys] = %w(/Users/jnich/.ssh/id_dsa)
</pre>
<p>Given this, I should be able to run &#8220;cap shell&#8221; and enter a command like &#8220;on app hostname&#8221; and see it work, but instead I get things like</p>
<p>connection failed for: app (Errno::ECONNREFUSED: Connection refused &#8211; connect(2))</p>
<p><em>Aside</em>: In looking into how Capistrano uses Net::SSH, I found this page from Jamis that describes how Capistrano uses Net::SSH internally. Of note is this particular line: </p>
<pre class="brush:ruby">
config.logger = Capistrano::Logger.new(:output => "/dev/null")
</pre>
<p>One of the reasons people sneer at Rails as a platform for enterprise-class applications is crap like this. If you hard-coded the logger to /dev/null in a production class, don&#8217;t expect people to take your code seriously, no matter how many f-bombs your team lead drops when making public speeches.</p>
<p><strong>Updated:</strong>I&#8217;ve resolved my Dreamhost/Rails deployment issues without using Capistrano for the moment. Somehow, in the course of messing around, I managed to make my Dreamhost home directory group-writeable, which had the effect making the Dreamhost sshd ignore my .ssh directory (since it was potentially compromised.) </p>
<p>To deploy, I simply did an svn checkout. That makes more sense to me than the Capistrano method, which involves endless messing around with symlinks and archived copies of the application.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xmlhead.com/archives/6/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

