Rails for PHP Developers

This review was originally printed in the June 2008 edition of the UKUUG newsletter, which is now defunct.

Title: Rails for PHP Developers
Authors: Derek Devries, Mike Naberezny
ISBN: 9781934356043

As someone who relies on web development for the majority of my freelance work, I have been intending to get up to speed with this Ruby on Rails thing which everyone has been talking about for some time. Unfortunately, with several years of (possibly bad) PHP habits ingrained into my memory, picking up a new way of thinking from the existing Ruby on Rails books has been quite tricky, so a text which proclaims to be ‘Rails for PHP programmers’ sounds like the ideal solution to my problem.

The book begins as might be expected, with a short history of Rails and a brief nod in Ruby’s direction, plus an overview of the Model View Controller (MVC) pattern. Thankfully, the authors stay clear of evangelising at this point – simply pointing out the main aspects of MVC rather than launching into a sermon – which makes a refreshing change from some other Rails books that I’ve read. The section on installing Rails is also kept brief, again a welcome change from some books (not just those focusing on Rails) which often pad themselves out with an entire chapter on installation, when all that is required is to run one or two lines in your package management software or download a setup file.

Moving swiftly on, I’m impressed to see my first Rails app up and running by page 11 – instant gratification if ever there was such a thing. Admittedly it doesn’t do much, but by the end of chapter one I’ve followed the examples and got a functioning mailing list subscription form up and running, using only a tiny amount of code. Later chapters are a little bit disappointing as the pace slows drastically when new concepts from Ruby which don’t exist in PHP are introduced, and you have to wait until chapter five before things start going again.

The chapter which I found the most useful however was ‘Deploying the Application’. With PHP, I’m used to just copying the code to a server with Apache and mod_php installed and having it ‘just work’, whereas Rails applications require significantly more effort. Thankfully, the book takes you through setting up and deploying a Rails application in a step by step process, in one of the most clear and concise ways I’ve seen.

In addition to specific pieces of content, the great thing about this book is that it really does do what it says on the tin. Each Rails example is preceded by the corresponding PHP, which makes it easy to see how a construct in one language maps into the other, and suddenly the move from PHP to Rails doesn’t seem so difficult. There are also plenty of side boxes which explain why something is different in Rails, or why some tasks are possible in one language but not the other.

My only minor criticism of the book is that in one or two places the authors have used what feels like deliberately poor PHP in order to emphasise the advantages of Rails, but this doesn’t detract too much from the overall quality. Furthermore, the authors do admit that frameworks exist for PHP, so if you decide that Rails isn’t your cup of tea you can still do similar things in the language you’re already comfortable with.

Overall, I’d suggest that if you’re a PHP programmer who wants to get up to speed with Rails without moving too far from your comfort zone, this is the book for you. Anyone else should probably look elsewhere though as this book is really only useful if you fit the exact niche which it is aiming for.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.