Ruby for Rails

8 comments | Posted: 31 May 06 in Books, by Robert Evans

Ruby for Rails I recently finished reading the PDF version of Ruby for Rails authored by the talented David A. Black. This book was release in printed version this month and I was pleased to receive mine a few days ago. Ruby on Rails has really taken the web by storm. This powerful framework has shed light on Agile Development Practices that have been previously talked about in the programming world, but haven’t had the acclaim as it does now.

Ruby for Rails, takes the Rails programmer on the journey of learning and developing his/her Ruby skills. I think David Hansson, creator of Rails, states it well in the forward of this book:

“Ruby is such an incredibly rich and expressive language that it’s hard to appreciate its beauty by simply relating it to past experiences with other languages”.

In this book, David Black shows his passion for Ruby and his ambition to teach it to others who desire to learn. The book is not like other technical books of the past, it is easy to read, easy to follow and there are code snippets with great explanations of the how’s and why’s of using it. The follow is what this book covers:

Ruby/Rails Landscape

The first section of this book takes you through the basics of how Ruby works and how Rails works, then about Ruby informed Rails. The first chapter teaches you the basics of the Ruby language such as, syntax, operators like the plus sign, Interactive Ruby (irb), method calls, the anatomy of the Ruby environment, extensions and libraries, and walks you through the creation of your first Ruby (no Rails) program.

The second chapter talks about the MVC, or Model-View-Controller framework architecture and Rails implementation of it. The chapter also shows you how to create your first Rails application, that later on the book walks you through finishing. It also teaches you what your code is doing.

The last chapter in this section takes what you have learned in the previous two chapters and brings it all together showing you why knowing and understanding Ruby will make you a better Rails programmer.

What I really like about the first part of this book, is that it not only is great for first time Ruby/Rails programmers, but it also a great refresher for those who know a bit of Ruby, but aren’t experts in the language. David does a great job at and hitting a wide range audience.

Ruby Building Blocks

This and the next section is the core of the book. David does a great job at explaining Objects, Classes and variables and how and when to implement them. He covers that everything in Ruby is an object with many great examples for you to test out. He covers Modules and the self object, which are often difficult subjects in Ruby to grasp. He explains the difference between Modules and Classes and discusses best practices of when to use one over the other.

David covers Control Flow Techniques such as loops, conditional statements, iterators and error handling. He gracefully explains code blocks that leaves you with, “Ah! Now that makes sense!”

Built-in Classes and Modules

The second core section of this book takes from the previous section and builds on what you just learned. It takes you more in depth with iterators, talks about how you can call your methods with syntactic sugar rather than the method-call notation. An example would be that you can define a plus sign method on an object you’ve created.

The section goes on to talk about Scalar objects, collections, enumerability, regular expressions and regexp-based string operations and Ruby dynamics.

Rails through Ruby, Ruby through Rails

This last section walks you through creating a Music application and ends up taking you in depth through programmatically enhancing ActiveRecord, enhancing controllers and views and gives you great techniques for exploring the Rails source code.

David does a brilliant job at ending this book with such valuable information for those who desire to write plugins for Rails, and learn more about the inside guts of the framework they are using.

Summary

This book is by far one of the best purchases I have made to develop my own Ruby and Rails skills. It takes the approach of focusing in on those who are beginner Rails programmers on up to those who have been programming in Rails for some time, but have not gone through Ruby in depth to better understand Rails. This book is not a complete Ruby reference, but rather a comprehensive Ruby tutorial.

I have read several Ruby books, and not one comes close to matching David’s style that is informative, passionate, and shows a strong desire and ambition to teach Ruby. This is by far the best book currently on the shelves for those who want to understand Ruby better and become a better Rails and Ruby programmer. The only thing you stand to lose by reading this book is becoming more knowledgeable about the language and framework.

Discuss This Topic

  1. 1 Brad Garland

    Thanks for the review, I considered picking up this book at SXSWi a few months ago but decided against it. Question, what Rails version does it assume in this book?

    I’ve recently been giving a bit of a setback due to the new Agile Web Development Book’s 2nd release and says alot of the stuff in the 1st edition doesn’t apply anymore.

    How does this one stack up?
    Is it more conceptual?

     
  2. 2 Robert

    It covers Rails 1.0 basics.

    The focus isn’t really on Rails itself, but rather on Ruby how to implement Ruby in your Rails applications. It sounds a bit redunant because Rails is written in Ruby, but so many Rails programmers don’t know Ruby.

    I have the Agile Web Dev 2nd edition and I see this book as your Rails source for when you have questions about the Rails architecture.

    David’s book is focused on teaching you Ruby so that when you use Rails, you are a better Rails programmer. He just takes the approach of reaching those who have mingled with Rails or who have looked into Rails.

    Personally, for any Rails developer that is serious about writing applications using the Rails framework, you should have the Agile Dev book and Ruby for Rails. Both are great tutorials on how to use the respective language and framework.

    I honestly feel if you want to be a good developer using this language, you only stand to be more knowlegable after finishing David’s book.

     
  3. 3 Ryan

    This is absolutely one of the best books available for Ruby and/or Rails. For developing real-life web applications, it is so important to have a good understanding of what is happening behind the curtain, and Black’s Ruby for Rails is a wonderfully in-depth tour through Ruby and the things you need to know to take control of Rails.

    And who would have thought that it would actually be interesting to read about stacks, control structures, and object scope? But Black pulls it off nicely, and keeps you awake while reading.

    Great review Robert!

     
  4. 4 Robert

    Thanks Ryan. It is a fantastic book and the it book if you want to know Ruby while working with Rails. No Rails programmer should be without this book in their library!

     
  5. 5 chutney

    How about those of us who do good to hack on a PHP plugin for WordPress? Above our paygrade or no?

     
  6. 6 Robert

    Chutney: If you are just starting with Ruby, this book is good for beginners as well. It really covers the gamut for beginners and intermediate Ruby programmers.

    If you are just starting Rails, this book will be a great help in learning the language Rails is written in and the language you will work with when you write Rails programs.

     
  7. 7 Sandeep Daksh

    Hi,

    This is Sandeep Daksh doing MCA.

    I want to learn Ruby on Rails so, from where i should start .

    I`m totally blank but , i want to learn it.

     
  8. 8 Robert

    Sandeep: start at http://rubyonrails.org, then the Agile Web Development with Rails and Ruby for Rails. The former gets deep with Rails, the latter deep into Ruby.

     

Comments closed after 2 weeks.