Wednesday, November 25, 2015

Review / Ruby on Rails Tutorial: Learn Web Development with Rails by Michael Hartl

When I started at Shopify in the summer, the only Ruby I knew was from reviewing a children's book, and I didn't know any Rails at all. So I needed to get up to speed, and fast. Michael Hartl's Ruby on Rails Tutorial was my first, and still my favourite, go-to resource.


You can buy a copy of Hartl's tutorial, or read it for free online. If you buy it, you can also get supplementary learning material like solution manuals and screencasts. So far, I've just been working through the online version and skipping the exercises found at the end of each chapter (though I think the exercises are worthwhile, especially if you are not using Rails at work in parallel to learning it).

The coolest thing about this tutorial is the partnership that Hartl set up with Cloud9, a cloud-based development environment. When you're just getting started with something new, it is very helpful to avoid the headaches that inevitably come with setting up your own machine for development. Instead, you can use the tutorial-specific, preconfigured workspace on Cloud9 that leaves out only exactly what Hartl wants to walk you through. It's also really easy to deploy to Heroku from Cloud9, allowing you to easily test your website in production.

The structure of the book is well thought out. You get to make a fully functioning, if simplistic, web app in the first chapter using the automation tools available in Rails.  In the next couple of chapters, some of the key concepts of Rails are introduced and you learn to create static pages.  Chapter 4 delves into some Ruby-specific programming concepts. I'm not sure how well a beginner would be able to program after reading a single chapter, but then again, I'm not sure how good at programming you even have to be to write a small, straightforward Rails app anyway.

After the introductory chapters, the rest of the book is devoted to creating a Twitter-like micro-post website. A lot of the initial focus is on users, which makes sense pedagogically: it allows the learner to focus on the key concepts surrounding information stored in a database with a single model, which makes it a lot less confusing. The downside is that you don't get to the actual micro-posts, the meat of this particular application, until chapter 11. I found myself losing interest by then.

Overall, though, this is a great way to learn Rails, especially if you have some programming background, and probably even without any. The language is clear, direct, simple, and friendly. The examples are carefully designed to introduce as few concepts at a time as possible. Highly recommended.