Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror
×

Ruby For Rails 173

Simon P. Chappell writes "This may not be the book that you think it is, if you don't read the title carefully, but it is the book you need, if you are developing applications for Ruby On Rails (often known as just Rails, or RoR, to its friends). When learning any new development platform, there are many idioms and approaches, best practices if you will, that can benefit your development efforts. This book sets out to bring you that understanding of the best way to write the Ruby side of your Rails application." Read the rest of Simon's review.
Ruby For Rails
author David A. Black
pages 493 (17 page index)
publisher Manning
rating 10/10
reviewer Simon P. Chappell
ISBN 1932394699
summary A stunningly well written explanation of real-world Ruby skills for Rails development.


I see two main audiences for this book. The first group would be those who are learning to develop Rails applications and need some help with their Ruby skills. The second group would be those who already have good Ruby chops, but who want to learn the primary Rails idioms and techniques. Naturally, there is always the curious geek crowd who might find the twofer of an introduction to writing real-world Ruby and a hype-free description of what Rails actually brings to web development, to be quite attractive. I place myself firmly in the third group, but after reading this book, I'm ready to move to the first group.

To quote it's own website, "Rails is a full-stack framework for developing database-backed web applications according to the Model-View-Control pattern." The first thing this tells us is that like any framework worth it's salt, it is fully buzzword compliant. The second thing it tells us is that it really does try to help with every layer of your application, from providing a full controller to automatically mapping your data objects to their respective backend database tables. Oh, and with the bare minimum of configuration files to boot! For those of us who have developed web applications with Java, this is a welcome break.

The first part describes "The Ruby/Rails Landscape" and has three chapters that describe how Ruby works, how Rails works and then shows a very simple example of Ruby-enhanced Rails development.

The second part describes "Ruby Building Blocks" spanning five chapters, four through eight. This part is a very good tutorial style introduction to Ruby. Chapter four introduces objects and variables with chapter five showing how to organize those objects with the concept of classes. Chapter six introduces us to modules and program organization in general. Chapter seven talks about the default object, self, and scope. Chapter eight covers control flow techniques. This is more than just a fancy way of saying conditionals and loops, because it includes one of the better explanations of closures that I've read to date.

The third part describes "Built-in Classes and Modules", in chapters nine through thirteen. Chapter nine covers some of the Ruby language essentials for Ruby development in the trenches. These include useful syntactic sugar, the family of methods that change data "in place" rather than returning a modified copy, some of the tricky aspects of the Boolean objects and the proper ways to compare two objects so that you get a comparison on their contents, which is likely to be what you want, rather than their memory location. Chapter ten looks at scalar objects: strings, symbols, numbers, times and dates. Chapter eleven examines the Ruby collections: arrays and hashes and discusses when you would use each one, based on their relative strengths. Chapter twelve looks at the regular-expression facilities within Ruby and chapter thirteen wraps up our tour of Ruby with some of the dynamic aspects of the language, including the "eval" family of methods that allow a Ruby program to run arbitrary code.

The fourth and final part describes "Rails Through Ruby and Ruby Through Rails". To quote the book, the purpose of the fourth part is "helping you get more out of Rails by knowing more about Ruby." To this end the simple application created in the first part of the book is revisited and revised. Chapter fourteen starts us out with remodeling the application written back in chapter three. Chapter fifteen looks at programmatically enhancing ActiveRecord models. Chapter sixteen covers the options available for enhancing the controllers and views. Finally, the part wraps up with chapter seventeen where techniques (and much encouragement) for exploring the Rails source code are shared.

The writing is excellent and the style is very engaging. Every concept is stunning well explained. Much as I liked and enjoyed "Programming Ruby" (the "pickaxe book" to it's friends) by Thomas, Fowler and Hunt, this book takes the state of Ruby writing to a new level.

The progression of the book is very well thought out. The first part introduces us to both Ruby and Rails. You can create basic Rails applications with very little Ruby and that's exactly what this first part walks you through. Then parts two and three teach Ruby skills and idioms that are directly applicable to Rail application creation. Part four takes these new skills and shows them being applied to the second Rails application of the book. I found this to be a very good sequence for progressing through the material.

The examples in the book are excellent and many of them are geared towards Rails-style situations. This not only helps to teach Ruby skills, but also keeps the Rails context firmly front and center during the process.

The index on this book is a magnificent 17 pages. That's not something you see too often.. The art of a good index seems to be somewhat lacking these days, but this book helps to redress the balance.

If Ruby on Rails is of no interest, then this book is most likely not the one you want. Also, if you were looking for something with an exhaustive, reference-style, coverage of Ruby, perhaps you'd be better off considering something like the "Programming Ruby" book.

This is a great book, that's very easy and enjoyable to read. It's a stunningly well written explanation of real-world Ruby skills for Rails development."


You can purchase Ruby For Rails from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page
This discussion has been archived. No new comments can be posted.

Ruby For Rails

Comments Filter:
  • Re:Fad (Score:5, Insightful)

    by misleb ( 129952 ) on Wednesday July 12, 2006 @04:48PM (#15708255)
    I would invest time and money in Ruby on Rails, except that it is obviously a passing fad. This is because Rails is designed to solve a specific problem (serving web pages),


    Doesn't this apply equally well to every other web framework out there? Browsers are designed to solve the specific problem of reading web pages? Are they just a fad too?

    -matthew
  • Re:I knew it! (Score:5, Insightful)

    by misleb ( 129952 ) on Wednesday July 12, 2006 @04:56PM (#15708324)
    Are you being facetious? Or are you actually annoyed that you had to learn a programming language and a framework to do something useful with Rails? I can't tell.

    -matthew
  • Re:Fad (Score:5, Insightful)

    by misleb ( 129952 ) on Wednesday July 12, 2006 @05:13PM (#15708463)
    Ok, so basically what you are saying is that we should only learn programming languages on a very academic level and never learn to apply them to specific problems because some day those problems will no longer be problems and all of our time learning to apply the language in will be wasted. Do I understand you correctly?

    I can tell you this, if it weren't for Rails I would never have learned Ruby in the first place. Writing Rails applicaitons gives me a chance to learn a whole lot more than just the specific details of the framework. No only have I learned Ruby, but I've been introduced to test driven development and other good practices that were nowhere in the PHP world. It was actually the unstructured PHP world that I have found to be a waste of time.

    -matthew
  • Re:Fad (Score:3, Insightful)

    by jaydonnell ( 648194 ) * on Wednesday July 12, 2006 @05:27PM (#15708577) Homepage
    Almost every problem that someone solves is a "passing fad" by your definition. Why learn how to build bridges when we will have flying cars one day? The reason is that learning how to solve an immediate problem well, i.e. serving web pages, will help you know how to solve other, future, problems. Learning rails helped me understand what good clean code should look like. This will help me with any coding problem I try to solve in the future.
  • Re:Fad (Score:3, Insightful)

    by Decaff ( 42676 ) on Wednesday July 12, 2006 @05:45PM (#15708704)
    There's no reason to assume that Rails will fail in the near term. Rails is based on a method of decomposing software functionality that does back to the 1970s (Model-View-Controller). Rails might not be here forever, but it has a very solid architectural foundation and it is easy to adapt it to the latest trends (for instance, you can create AJAX-based Web applications very easily with RoR). In other words, the extensibility and architecure of Rails make it adaptable, just as you mention Ruby being adaptable.

    This may be true, but Rails is also based on an approach to object-relational mapping (Active Record) that is not widely used and with only limited applicability. It assumes that the database schema is the centre of the data model. This is a very narrow view of data. Increasingly data comes from other sources than relational databases. To see how sophisticated this can get look at Xcalia - a Java product that can persist and retrieve data from just about anything - LDAP, XML, Databases - even SOAP services. Although I am no Microsoft fan, they are heading the right way with their new LINQ persistence system on .NET that allows querying and persistence to almost anything including in-memory objects. ActiveRecord is a very neat implementation of a very old-fashioned approach.
  • by fupeg ( 653970 ) on Wednesday July 12, 2006 @05:45PM (#15708705)
    For those of us who have developed web applications with Java, this is a welcome break.
    People like to think that RoR came from the same spring that produced Python and PHP. That might be true of Ruby, but not RoR. Nope, RoR is made for Java devs. That's why they make such a big deal about the lack of configuration. Java frameworks have a notorious amount of configuration. RoR is very natural for Java devs who are also used to MVC frameworks for web apps. It is not as compelling to PHP and Python developers, even though Ruby is a lot closer to those languages than it is to Java.
  • by Qbertino ( 265505 ) <moiraNO@SPAMmodparlor.com> on Wednesday July 12, 2006 @05:59PM (#15708784)
    Quit the hype allready. There are at least 3 oss web packages out there that are better in more than just a few aspects:
    django ( http://www.djangoproject.com/ [djangoproject.com] )
    Symfony ( http://www.symfony-project.com/ [symfony-project.com] )
    Zope ( http://www.zope.org/ [zope.org] )
    Zope is by far the oldest and most sophisticated. Django is Rails done right and in Python and Symfony is a PHP metaframework that includes Propel and some other third party goodies with tons of very neat PHP 5 foundation work. Each one of these kick Rails up and down the street when it comes to ease of use, ease of deployment, available documentation and performance (Zope may be a little slower, but they have a full-blownobject relational DB built in that makes SQL look like peek and poking a c64 back in 1985).
    And since the Ruby on Rails people use PHP to power their Rails website (oh, the irony; http://rubyonrails.org/index.php [rubyonrails.org] ) I'd trust in even PHP being able to perform more than good in the newest lineup of Frameworks.

    So quit the rails-only hype allready, it's anoying.
  • by killjoe ( 766577 ) on Wednesday July 12, 2006 @06:44PM (#15709076)
    Django:
        Overall very nice. No capistrano, no migrations, no built in support the unit testing like rails. Great admin interface, very fast.

    Symfony:
            Don't know, never used it, never will because it's PHP and I don't like PHP anymore.

    Zope:
          Aaah zope. So much innovation, so much potential, so much going for it but in the end so hard to learn and use. Very slow. documentation not all that great. TTW design is a HUGE drain on productivity. No support to deployments. You can keep your stinkin migrations because we have a object oriented database. Testing is a pain. I actually like aquisition. It's great the security is built in. There are too many half asses, half finished, half functional products which all have weird dependencies on other broken products. Where are the gems or CPAN?

    I think zope is brilliant but I also think it's wasted potential. For some reason this great and innovative framework has not produced the likes of wordpress, sourceforge, a halfway decent bug tracking system, or anything else (except for plone of course). A good framework should produce great products and zope has failed in that.

  • by mzatko ( 988541 ) on Wednesday July 12, 2006 @07:39PM (#15709332)
    Rails ain't hype, as a fulltime Java programmer who got a little too curious, I can tell you that this is the real deal. I dislike people who discount other languages and frameworks just because it isn't their favorite framework they've been using. Attachment is an awful trait in the programming industry. I won't discount any of the frameworks you've mentioned because I simply havn't used them, but in comparison to Java frameworks I've used for many years, Rails blew them all away. I see a bright future for Ruby, Rails, and other Ruby based frameworks. On topic, this is a good book for those who have spent some time with Rails and want to dig into the underlying (and magnificent) Ruby language. I met David Black at a PhillyOnRails user group meeting and actually got a signed copy of his book. Good stuff!

All seems condemned in the long run to approximate a state akin to Gaussian noise. -- James Martin

Working...