Digital Web Magazine

The web professional's online magazine of choice.

Book Review: Beginning Rails

Got something to say?

Share your comments on this topic with other web professionals

In: Reviews > Book Reviews

By Matthew Pennell

Published on August 20, 2007

Beginning Rails As a card-carrying member of the web-standards blogosphere, I somehow feel a little odd holding a book that is not published by friends of ED or New Riders (and, what's more, doesn't have a foreword by either Andy Budd or Dave Shea)—but when one ventures into the world of back-end coding, one has to give up certain safety blankets and pick up more serious-looking books.

As a freelance web developer, I've long had Ruby on Rails on my list of ‘Things I really should get around to learning one day’—it has such a vocal and enthusiastic community, and powers so many of the sites and applications I use every day, it seemed inevitable that it would be added to the list of languages-with-confusingly-similar-syntax in my programming arsenal.

Who is the book for?

With a title like Beginning Rails, it's no surprise that the book is aimed at the novice developer, although absolute beginners may struggle, especially if this is their first foray into server-side programming. The appendices provide a brief introduction to Ruby syntax and database theory, but if you have never touched a line of PHP, Perl, or even JavaScript in your life, be prepared for a little head-scratching as common programming concepts are introduced. (If you still don't know what Rails is, read our introduction: Ruby on Rails For The Rest Of Us.)

For most putative beginners, this will be not just an introduction to Rails, but also a first experience with an MVC (Model-View-Controller) framework; the book takes time to explain this important engineering pattern, and the authors do an excellent job of imbuing the reader with a sense of the philosophy behind Ruby on Rails. Coming to the book with a vague understanding of MVC through my experience with the PHP framework Code Igniter, I finished the chapter feeling much more confident in applying the various principles—Don't Repeat Yourself, convention over configuration—and a desire to keep my code (not just my Ruby) clean and pure.

What will I learn?

The book truly does start right at the very beginning, with a detailed installation walkthrough on all major platforms (Mac OS X, Windows, and Linux). I was disappointed that after the helpful Windows installation instructions, there wasn't a single mention of how to use Rails' built-in generators and helper tools on that platform (you have to specify the program to use on Windows, in case anyone else comes up against the same problem: $ ruby script\generate controller Example).

For a Rails novice, what follows is a series of head-shaking, ‘That's cool!’ moments, as the book walks you through the basics of developing with Ruby on Rails; using the built-in web server, auto-generating files, finding your way around the interactive console, using the scaffolding feature (which allows you to create an entire database front-end with only one line of code), and creating and managing database migrations are all smoothly covered. The authors sensibly keep the explanations to a minimum in favor of allowing the reader to experiment and learn by doing. The authors wisely choose a familiar topic, and over the course of the 350-plus pages, the reader is guided through the construction of a functional events website (think Upcoming.org), which provides plenty of opportunity to demonstrate the key features of the Rails framework.

Two chapters are dedicated to the core of Rails' database interaction, Active Record, fairly early on in the book. Although it initially felt like it was too early to be wading through object-relational mapping, associations, and validation, in retrospect it is absolutely the right place to cover the topic, and indeed throughout the book, the structure is well thought-out and the information never overwhelms the novice reader.

The chapter on AJAX will have accessibility advocates gritting their teeth at the inline scripts and obtrusive techniques that Rails makes possible, but the ease with which these techniques can be applied is breathtaking, and the book covers all the most useful helpers available with the bundled Prototype and script.aculo.us JavaScript libraries. The book is rounded out with sections on testing and deploying applications.

Summary

While the book suffers from some unfortunate typos that would have hamstrung a true beginner, one hopes that these will have been corrected in subsequent editions. Overall, it does a great job of introducing not only the technical and theoretical concepts behind the successful framework, but also imparting much of the philosophy that has made Ruby on Rails such a hit with web authors.

Got something to say?

Share your comments  with other professionals (15 comments)

Related Topics: Technology, Programming

 

Matthew Pennell works as a senior designer for one of Europe's leading hotel booking websites, writing semantic XHTML, bleeding-edge CSS and JavaScript that usually works. He is the former Managing Editor and former Editor in Chief of Digital Web, and blogs at The Watchmaker Project.

Media Temple

via Ad Packs