UKUUG home

UKUUG

(the UK's Unix & Open Systems User Group)

Home

Events

About UKUUG

UKUUG Diary

Membership

Book Discounts

Other Discounts

Mailing lists

Sponsors

Newsletter

Consulting

 


 

Learning Rails

Simon St. Laurent and Edd Dumbill
Published by O'Reilly Media
ISBN: 978-0-596-51877-6
442 pages
£ 24.99
Published: 28th November 2008
reviewed by Mike Smith
   in the March 2009 issue (pdf), (html)
bookcover  

Hello. It's been a while since my last book review, so good to be back, and I hope you're all having a reasonable 2009 so far. For those who don't remember, I'm an infrastructure person (formerly a UNIX SysAdmin), who dabbles with programming from time to time … but I am certainly no developer. I've always wondered what's so good about Ruby, and Rails, but never got into it. I know (knew, but the time you read this, I hope) virtually nothing about either so I was interested to work out whether “Learning Rails” is good for the absolute beginner like myself; and whether I'd be able to pick up Ruby as well as Rails from a book like this.

In case there are others reading with similarly little knowledge of this area, I slight diversion:

1. Ruby is the programming language, originating in the 90's in Japan. It has concepts from many other languages, including SmallTalk (which I learnt myself at Uni but have completely forgotten!), Perl, C, Python etc. The first book published in English is now available for free, (on ruby-doc.org), but there's also an O'Reilly book, The Ruby Programming Language, co-authored by the man himself, Yukihiro Matsumoto. It looks to me like a bit of a modern classic in its new form (it was a Nutshell in a previous guise) and has been compared to K&R's The C Programming Language: i.e. the definitive text.

2. Rails is a framework, which to the layman like me is an environment and set of libraries which make it easier to develop applications that obey particular good-practice (such as the Model-View-Controller architecture used here and elsewhere). It was created by David Heinemeier Hansson in 2003, and version 2.2 was released in November 2008 (.. the buzz at the moment is all about 2.3rc1 and I suspect that by the time you read this 2.3 will be out).

Back to the book: The emphasis is on the practical and pragmatic; and it suits me down to the ground. We get started by looking at three options for running Rails: An online environment (Heroku), InstantRails (which is a packaged up Windows installation) and finally the command-line installation of individual RoR components (could be on Linux, Mac or Doze). From there we're straight on to creating our first Hello World web application.

I worked through the initial examples, and uncovered some careless mistakes. I've submitted these to the errata website, but having previously worked on an O'Reilly manuscript (the SSH book), there's no excuse for this — it should have been caught prior to publication simply by someone doing what I did.

Having learnt how Rails goes about rendering the presentation layer, using Views and Layouts, we then move over to Controllers and Models. This is where we find the actual Ruby code, and we build a second application to explore this area. This only takes a moment or two using Rails' scaffolding. (You see, talking like a pro already!)

Each chapter has a little quiz at the end. I'm not usually a fan of this (reminds me too much of text books and therefore exams), but in this case it does its job — it makes you stop and think, and acts as a refresher.

A few more chapters in, and we're adding validation code, handling file uploads and discussing RESTful apps. Then we're working with multiple database tables and adding relationships between them; Standard relational database stuff, but without the SQL!

Again with its pragmatic approach, and we're a little more than half way through the book by now, we look at debugging techniques and setting up test frameworks (unit testing, functional testing and integration.)

After that brief intermission we return to some interesting web-related coding topics: Sessions, Cookies and a foray into Ajax. I didn't work through these later examples from scratch, but downloaded them from the book's supporting website. I had at some point upgraded to the latest version of Rails and I couldn't then launch the examples (no errors, so I had to guess what was up … some clues were provoked by running rake, Rails' version of the make command). I worked it out, and simply reinstalled an earlier version of Rails by doing a “gem install -v=2.1.0 rails”. That did the trick.

The book is rounded off with some brief appendices covering Ruby itself, relational databases, regular expressions and a quick reference of Helper Methods.

Just to mention, there's a Facebook page for the book too. Only the two authors and one other fan currently present. Oh dear. Though they have uploaded a demonstration video:
http://www.facebook.com/pages/Learning-Rails/56672626496

One final comment: I've been playing with Amazon's Cloud (EC2 and S3) of late, and Amazon's AWS tools are available as Ruby gems too, so may be worth experimenting with RoR there.

So overall this book did absolutely give me that quick introduction to what Rails is all about. I picked up a few Ruby factoids along the way, but I think O'Reilly's other book on this will be a worthwhile investment to get a full appreciation of this object-oriented language. I liked the style of Learning Rails too — none of that high-brow theory and philosophical architectural discussion. We just get on and do it. And with these basics under my belt, I feel confident I understand enough to take the next steps, just referring to online resources when I need to. That, I think, is a good testament to this particular book.

Back to reviews list

Tel: 01763 273 475
Fax: 01763 273 255
Web: Webmaster
Queries: Ask Here
Join UKUUG Today!

UKUUG Secretariat
PO BOX 37
Buntingford
Herts
SG9 9UQ
More information

Page last modified 02 Mar 2009
Copyright © 1995-2011 UKUUG Ltd.