Skip to topic | Skip to bottom
Home
Main
Main.LinuxBookReviewsAgileWebDevelopmentwithRailsr1.2 - 22 Aug 2006 - 03:34 - LeeMcKusicktopic end

Start of topic | Skip to actions

Agile Web Development with Rails

By Dave Thomas, David Heinemeier Hansson with Leon Breedt, Mike Clark, Thomas Fuchs, and Andreas Schwarz, published by The Pragmatic Bookshelf

Reviewed by LeeMcKusick

Agile Web Development with Rails tells how to build a website using Rails.

This book is for a person who wants to build a website using the Rails system. The expected skills are you can download, edit files, and make directories. Installation instructions are provided for Linux, Mac and Windows users.

The practical audience for this book is you are a web developer or would be web developer evaluating Rails for what might become a big website. Agile Web Development starts simple and then covers design and testing and deployment. The book includes two case studies of deployment where the site traffic was hundreds of thousands of users per day.

The deployment chapter had a clang of correctness about how to scale a Rails system to "production". I recently worked for a company that has a 900 server Apache + Perl system. Agile Web Development points to a very similar "big system pathway" that is typically used by big open source websites.

The benefit of using Rails for website development that I see is rapid productive prototyping.

Agile Web Development is structured as a tutorial, 1/3 of the book. I have been following along and here is my result: In 12 to 14 hours (spread over 3 weeks) I have reached page 77 and so far I have running the following:

  • A database backed web site at http://localhost/store:3000
  • It has "add, edit, delete" actually working to the database.
  • It works without quoted mysql statements,
  • Maybe 90 lines typed by me.
  • About 2 hours spent on a Ubuntu specific installation problem.

Let me clarify that Rails is a program module created within the Ruby programming language. On the Internet, this is often called "Ruby on Rails". Rails suggests steel rails that provide easy rolling for heavy railroad cars.

The Rails system is built with several interesting ideas:

* Rails design and modules "favor convention over configuration" meaning a default behavior is usable right away.

  • Rails divides the work performed into a model, a view and a controller.

  • Rails provides a scaffolding of directories so that parts of the website are grouped.

  • Rails uses file names, file extensions and database name conventions to make things "just work" without requiring names embedded in quotes.

  • Rails provides code generators. I have used but not even looked at generated pages like an administrator's "add", "edit" and "delete".

Agile Web Development picks up strength as a resource because it is a multiple author book. The principal author Dave Thomas wrote Programming Ruby. The second author, David Heinemeier Hansson is the originator of the Rails module. The next authors are key figures in the rails implementation of web services, testing, Ajax and security.

A year ago I tried developing a web application by buying Programming Ruby, by Dave Thomas with Chad Fowler and Andy Hunt. I got tantalizing results but I didn't grasp the focus that Rails provides specifically for building websites.

Ruby is an elegant, beautiful language. Agile Web Development with Rails skips over the elegance of Ruby and spends energy explaining the scaffolding and ideas that focus the rubbery object inheritance of Ruby to the well known needs of the Internet web page system.

The rails mailing list suggests Rails is a successful environment:

The rails mailing list at rubyonrails-talk@googlegroups.com has 200 messages a day. There is a vigorous traffic with a lot problems being solved and relatively few distress calls.

There are relatively few web hosting providers that support Rails deployment:

One of the big deployment issues remaining with Rails is there are relatively few web hosting providers. An existing web hosting provider may not provide the ruby interpreter you need. On the mailing list, one member with a prototype couldn't proceed to deployment because his group had a prepaid year of hosting with a Perl-Php-Mysql-Apache provider.

This book shows how Rails has designed in solutions for testing and deployment:

The Agile book the book shows several ways for moving beyond prototypes. One of the authors is an originator of rails. These common web site development problems are deliberately addressed:

  • How do you move "to production" without changing the source code?
  • How do you create three parallel environments: prototype, testing and production?
  • How do you automate testing?

The index is helpful at filling in the gaps skipped by the tutorial:

The pace of the tutorial, as far as I have gotten, I find stunning. I see so much of a prototype coming together so fast that I get a "wait... what is the theory and what is actually happening at a program level" emergency.

On a short term basis, the index in Agile Web... is a good tool for jumping around and getting perspective on the interesting things happening while working through the tutorial.

Ubuntu Linux has some installation "gotchas" as of August 2006:

Ubuntu desktop Linux currently (08/2006) installs Ruby 1.8.3 which is rejected by the current Rails module.

Steps to work around Ubuntu file and version problems:

Get compiler tools from Ubuntu:

"sudo apt-get install gcc"

"sudo apt-get install build-essential"

Get ruby source from the ruby website:

Do the usual download, extract, ./configure, make

Get the gem source from the gems website:

Run "gem" to fetch and install rails.

If the gem install of rails complains of "zlib" missing:

Get the missing zlib library from Ubuntu: "sudo apt-get install libzlib-ruby"

Then, if still seeing the error, move the zlib file from the Ubuntu subdirectory to the subdirectory expected by your newly compiled Ruby (this is from an internet blog post):

"locate zlib.so. Find it in /usr/lib/ruby/site_ruby... the i686 directory... and copy files.

sudo cp /usr/lib/ruby/1.8/i486-linux/zlib.so /usr/local/lib/ruby/site_ruby/1.8/i686-linux/"

It seems the zlib error did not go away until I restarted my user session. Rails or the gem installer wouldn't pick up the new zlib file until I restarted the session.

Under Ubuntu, I had a similar problem getting rails to find and use the mysql program. Again, mysql was OK, but Rails didn't find mysql until I did a session restart. I found it helpful to verify mysql and the sample database were created. These tests clarify that mysql is ready to connect to the rails data model modules:

After you have created the Agile book database on page 55:

Run mysql from the command line:

mysql Run these SQL commands in the mysql interpreter:

show databases; (see the database you created)

use depot_development; (use the database you created)

show tables;

show create table products; (verify you typed each row OK)

exit

Once mysql is running, you can expect the rails model to be ready to pick up your database.

-- LeeMcKusick - 21 Aug 2006
to top


You are here: Main > LinuxBookReviewsAgileWebDevelopmentwithRails

to top

Copyright © 1999-2008 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback