Head First Rails: An Interview with David Griffiths

By Caitrin McCullough
January 13, 2009 | Comments: 2

David Griffiths is the author of the newly released Head First Rails. We sat down with him recently and asked him a few questions about his favorite subject.

What are some of the coolest things learners can do once they've worked through Head First Rails?

Wow — there's so much cool stuff in the book, where to begin? I wanted to write a book where people didn't just get to know stuff, but they actually learnt how to do stuff. So really the whole book is about how to do cool things. Like build a custom web application in two minutes. Or manage multiple data sets in a single interface. Or create a mashup with Google maps. Or using Ajax in really practical ways, not just for eye-candy. Cool is really just another word for powerful and I want people to finish this book armed with practical skills that they can apply from the get-go.

How do you think the Head First approach to Rails is different from other non-Head-First Rails books you've seen and used? How do you think Head First makes Rails easier to learn?

A lot of books provide information about Rails, but Head First Rails gives you something else as well: motivation. Motivation is a really key thing in learning any new topic. It doesn't matter how smart you are, if you don't feel motivated, then it will be really hard to learn anything. So how does Head First Rails motivate you? It uses fun and drama and scenarios. It has characters and plots and twists and turns. We use a lot of the same tricks they use in movies. Why? Because we want the teaching material to be compelling, like a movie is compelling. Rails is this incredible development framework. Things that used to take me four or five hours, I can now do in four or five minutes in Rails. That's an exciting thing! And Head First Rails is designed to convey that excitement.

What topic do you think people struggle with most in Rails? How did you address that topic in a way that will help learners who have struggled before?

One problem that I had when I first looked at Rails was figuring out how to create master-detail applications. These are applications where the user needs to manage multiple pieces of related information. You might have a blog post and its related comments. Or the example we have in the book is an airline called Coconut Airways which needs a system to manage flights and seat bookings. Now Rails is great at generating applications for managing single pieces of information, but if you want to create a master-detail app, well... you pretty much have to do it yourself. And that involves knowing about lots of different topics like database relationships and partials and even advanced subjects like Ajax. Head First Rails teaches you all those things in an integrated way. You don't have to skip back and forth between chapters. When I'd finished that section of the book, I kind of wished I'd had it when I was learning Rails.

coconut.png

 

What topic or section of the book are you most proud of? What did you do to make it especially effective?

The part of the book that I am most pleased with came at the end — with the Google Maps application. Why Google Maps? Because it's a great example of a mashup. To integrate with another application — whether it's Google, or LinkedIn or Twitter — you generally need to do two things: dynamically generate information in some format like XML, and then hook up some chunk of Ajax code. gmaps.png I was genuinely surprised when I was writing the book at how much people would be able to do in the final chapters. It was such a surprise that I changed the ending of the book! All of a sudden people could build this application where data was not only viewed, but also created and edited directly on the map . And the learner doesn't just build the app by blindly following some set of instructions but by actually understanding the code as they write it. It was a real surprise to me. I would never have dreamed that such a thing was possible when I began the book.

Is your book for people who've never studied Rails, or who have already worked with Rails?

If you've done any kind of programming before — whether it's in Java or Visual Basic or PHP — then you'll be able to learn Rails from this book. I think even someone who knows Rails will still get benefit from the book, but really the target audience is people coming to Rails for the first time. Rails is such a great framework — one that makes development so much faster — that even taking into account the time it takes to read the book, I think you'll ship your application faster if you build it in Rails. But then, maybe I'm biased...


Comments: 2

Nice

This is the most readable, useful Rails book I've found, and I've plowed through plenty of them. It's the only book I've worked through that really made me feel like I understood how the pieces fit together.

I feel a lot better about how controllers interact with everything else now. I've started to get an intuition for when you're supposed to use "@" in the context of Rails (how :locals plays into it, for instance). I never really understood how routes.rb worked until I read this book.

I like the fact that there are several distinct applications, rather than a single never-ending one. It keeps things interesting.

The one slight criticism I would have is how the Google maps mash up works: the reader is told to include a huge file in Javascript, which amounts to a black box. I can't help but wonder if that space might have been better dedicated to a an app based on a simpler web service, rather than one that required a big opaque wrapper.

That said, the final Google Maps mashup is super fun and motivational, and programming is really about coming to terms with abstractions anyway, so I think it's an acceptable tradeoff between using an external library and motivating the reader.

All in all, a fantastic piece of work, props to you David!

(Would love to see a sequel to this book!)

Leave a comment



RSS Feed

Twitter

Facebook


Looking for source files, code, exercise answers, and other materials to go along with your Head First book? Go to this page, find your book on the list, and click on the title.

Get The Latest Head First Tweets!

Get the latest Head First books here!

Head First Algebra Cover Head First PHP & MySQL Cover
Head First Rails Cover Head First Web Design Cover

Head First Algebra, Head First PHP & MySQL, Head First Rails, and Head First Web Design are now available.

Buy 2 Books, Get the 3rd FREE! Use the discount code OPC10 when you buy direct from O'Reilly.