<?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>Serene Studios Web design and development in Cambridge and London &#187; coding</title>
	<atom:link href="http://www.serenestudios.co.uk/category/coding/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.serenestudios.co.uk</link>
	<description>Serene Studios is a small team of creative minds that build websites, web presences, and  online social engagements.</description>
	<lastBuildDate>Sat, 22 May 2010 11:43:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>From the ridiculous to the sublime: Moving from PHP to Ruby on Rails</title>
		<link>http://www.serenestudios.co.uk/2009/05/22/from-the-ridiculous-to-the-sublime-moving-from-php-to-ruby-on-rails/</link>
		<comments>http://www.serenestudios.co.uk/2009/05/22/from-the-ridiculous-to-the-sublime-moving-from-php-to-ruby-on-rails/#comments</comments>
		<pubDate>Fri, 22 May 2009 11:22:32 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[startup]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.serenestudios.co.uk/?p=137</guid>
		<description><![CDATA[Introduction
I’ve been a PHP developer for many years. From my earliest little scripts to our latest fully-fledged web 2.0 apps, PHP has been at the heart of it all. I can read, write, and debug PHP faster than Paris Hilton. If a client wants a new website with any kind of functionality beyond XHTML etc. [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>I’ve been a PHP developer for many years. From my earliest little scripts to our latest fully-fledged web 2.0 apps, PHP has been at the heart of it all. I can read, write, and debug PHP faster than Paris Hilton. If a client wants a new website with any kind of functionality beyond XHTML etc. then PHP it was. I could do everything I wanted, and anything I couldn’t do there’s a billion tutorials and classes on the internet.</p>
<p>Yet, recently its not been that great. Big apps are taking longer and longer to debug or roll out new features. Despite writing nice commented object-orientated code, I’m still re-inventing the wheel too frequently for my liking.</p>
<p>Now, these are two things I hate doing. Really do not enjoy. At all. Its summer, there’s a beer festival in Cambridge, and loads of great music. Working freelance, I’m paid for results, not for now long it takes me to work out why PHP didn’t do what the manual said it would.</p>
<p>I tried to get round this by standardising all my classes and generic server structure, and guess what? It started to look pretty much like a <span class='bm_keywordlink'><a href="http://rubyonrails.org/" target="_blank">Rails</a></span> app. Oh dear, time to think seriously. Before getting into the <span class='bm_keywordlink'><a href="http://rubyonrails.org/" target="_blank">Ruby</a></span> though, I did know of <span class='bm_keywordlink'><a href="http://rubyonrails.org/" target="_blank">Ruby</a></span> a year or two ago, but never made the switch (in truth, I took one look and left). Why?</p>
<h2>Why PHP developers do not switch to <span class='bm_keywordlink'><a href="http://rubyonrails.org/" target="_blank">Ruby</a></span></h2>
<ol>
<li><strong>I know PHP, I don’t know <span class='bm_keywordlink'><a href="http://rubyonrails.org/" target="_blank">Ruby</a></span>: clients need the project delivered now.</strong> This one is pretty relevant to any fundamental change. You have projects on the go, or are due soon, and you know PHP – it works. Even at the planning stage, I can usually get a very accurate estimate of the time a PHP project will take to develop. <span class='bm_keywordlink'><a href="http://rubyonrails.org/" target="_blank">Ruby</a></span> has many, many unknowns. Will it support all the things I’ve promised the client? How long will a project take? I can’t charge my clients for the extra time it takes me to learn a new language.</li>
<li><strong>Losing control.</strong> PHP lets me control everything; right down to the errors it gives me when it doesn’t work. I know what every part of my app is doing, because I wrote it. <span class='bm_keywordlink'><a href="http://rubyonrails.org/" target="_blank">Ruby</a></span> seems to do a lot of stuff for me – how does it know what I’m wanting to do?</li>
<li><strong>It seems too easy.</strong> This, I must admit, was my main reason for putting it off. Back when I first started learning PHP (and C, C++ for that matter), your first application was called ‘Hello World’; it did nothing but output the words ‘hello world’. Now with <span class='bm_keywordlink'><a href="http://rubyonrails.org/" target="_blank">Ruby</a></span>, your first app is a blog. I mean really, what’s all that about. A blog app should be hundreds of lines of code even for the basics, let alone validation, displaying and so on. Sorry, but anything that can give me a blog app out the box is like one of those Nigerian email scams…</li>
</ol>
<p>Yet despite these hesitations, I took the leap and got stuck in. And you know what, it was magic.</p>
<p>There were the usual initiation woes – like the first time I switched to Mac, or the first time I played the Viola – were all the ability and creativity you had on your previous system suddenly get taken away, and you’re reduced to scrabbling around to get things working. But, these things are inevitable, so I kept going.</p>
<h2>Good start-up tutorials</h2>
<ol>
<li><strong><a title="Ruby on Rails Guides" href="http://guides.rubyonrails.org/" target="_blank">Ruby on Rails Guides (http://guides.rubyonrails.org/)</a>.</strong> Fantastic overview of the basics. A lot of it you’ll get through quickly (the MVC model, for example, is simply a nice logical extension of good coding practice in any language), but it does get you immersed.</li>
<li><strong><a title="Railcasts" href="http://railscasts.com/" target="_blank">Railscasts &#8211; Free Ruby on Rails Screencasts (http://railscasts.com/)</a></strong>. This guy’s a genius. I’ve never been a huge fan of screencasts, but I have to say, he’s got a clear simple solution for all the common features you might need: authentication, e-commerce, cms etc.</li>
<li><strong><a title="Learning Ruby" href="http://www.math.umd.edu/~dcarrera/ruby/0.3/" target="_blank">Learning Ruby (http://www.math.umd.edu/~dcarrera/ruby/0.3/)</a></strong>. <span class='bm_keywordlink'><a href="http://rubyonrails.org/" target="_blank">Rails</a></span> is of course more a framework than a language; <span class='bm_keywordlink'><a href="http://rubyonrails.org/" target="_blank">Ruby</a></span> is the actual language behind it all. This is probably the biggest learn: all the new syntax and control flows. The concepts behind <span class='bm_keywordlink'><a href="http://rubyonrails.org/" target="_blank">Rails</a></span> are probably pretty clear to an experienced developer, it’s the language that’s different.</li>
</ol>
<p>To finish then, I’ve written a list of the top five tips for PHP developers switching to <span class='bm_keywordlink'><a href="http://rubyonrails.org/" target="_blank">Ruby</a></span>. These are the points I wish I new before I started (or maybe I don’t, I certainly learnt a lot doing them the wrong way first)…</p>
<h2>Key points for PHP developers:</h2>
<ol>
<li><strong><span class='bm_keywordlink'><a href="http://rubyonrails.org/" target="_blank">Rails</a></span> wants you to do all the things your mother always told you.</strong> Get into the groove of a <span class='bm_keywordlink'><a href="http://rubyonrails.org/" target="_blank">Rails</a></span> App – it wants you to write DRY code, separate your models, controllers and views, write testing code, and so on. Go with it, don’t fight it.</li>
<li><strong>Don’t micro manage.</strong> <span class='bm_keywordlink'><a href="http://rubyonrails.org/" target="_blank">Rails</a></span>, for better or worse, takes care of a lot of stuff behind the scenes. Its not the perfect solution for every project, but if you think its right for you, then let <span class='bm_keywordlink'><a href="http://rubyonrails.org/" target="_blank">Rails</a></span> do the heavy lifting for you.</li>
<li><strong>Trust the syntax.</strong> I know it feels dirty and naked not ending each line with a nice ‘;’, but apparently the world doesn’t come to an end if you don’t. Write your code like natural language, then tidy it up a bit. It’ll probably work.</li>
<li><strong>Don’t re-invent the wheel, go for good gems.</strong> There’s a thousand <a title="GitHub" href="http://github.com/rails/rails/tree/master" target="_blank">brilliant gems out there</a> to do many things you could want your app to do: <a title="Restful Authentication" href="http://github.com/technoweenie/restful-authentication/tree/master" target="_blank">restful_authentication</a>, <a title="Active Merchant" href="http://www.activemerchant.org/" target="_blank">ActiveMerchant</a>, <a title="acts_as_tree" href="http://github.com/rails/acts_as_tree/tree/master" target="_blank">acts_as_tree</a>, and so on. Use them, and spend more time developing rather than re-inventing.</li>
<li><strong>Don’t kick yourself too hard…</strong> You only wasted hours of your life debugging poor PHP code.</li>
</ol>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/p5EIrSM8dCA&#038;hl=en&#038;fs=1&#038;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/p5EIrSM8dCA&#038;hl=en&#038;fs=1&#038;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.serenestudios.co.uk/2009/05/22/from-the-ridiculous-to-the-sublime-moving-from-php-to-ruby-on-rails/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
