Imagine you’ve never played the game of football (the American version) before. You’ve never even seen a football game, and you have no idea what the rules are. But somebody tells you it’s way hella cool, and you’ve got the build for it, why don’t you come on down and join the team.
So you suit up and get on the field, but you still don’t have the foggiest idea what’s going on. Sometimes people are running with the ball, sometimes they’re throwing the ball, sometimes they’re kicking it or just pushing other players around and jumping on them for seemingly no reason. You try to ask the other players what’s going on, and they’re perfectly willing to help you — but all you can catch is a few seconds of their time between plays when they’re out of breath.
That’s kind of how I feel trying to learn Ruby on Rails.
What the hell is Ruby on Rails? For all you non-technical people out there, it’s a programming environment that’s supposed to make development super, mega easy.
Those with a more technical bent have probably already heard about Ruby on Rails. But for those who haven’t, it’s an open-source web framework where you can use the popular Ruby language to build robust applications using the Model-View-Control pattern in an astonishingly few lines of code.
How easy is it? Well, once you’ve got it installed properly, you literally type “rails book” and then “ruby script/generate scaffold chapter.” In the space of seconds, RoR generates all of the files you need for a project called “book” composed of multiple “chapters.”
From there on out, it’s amazingly simple too. You can describe the data model with two basic statements:
class Book < ActiveRecord::Base
has_many :chapters
end
class Chapter < ActiveRecord::Base
belongs_to :book
end
RoR takes care of generating all of the HTML files needed to make it work on the fly. Within five minutes, you can have an application that will let you seamlessly add, edit, and delete chapters to a book. No more mucking around with granular SQL statements and spending hours debugging.
The problem is, you’ve got to get it installed properly.
And getting Ruby on Rails installed properly is a bitch. It’s taken me days, and I’m still not sure I’ve got it done right. Luckily, you don’t need a web server to serve up the application because RoR comes with a built-in lightweight web server called Webrick. Oh, but wait, Webrick isn’t powerful enough for a production server, so we need Apache. With the FastCGI module installed and configured for Ruby files. Oh, but wait, nobody uses FastCGI to do this anymore, everyone’s using something called Mongrel these days…
Compound this with the fact that every flavor of *nix has its own special tweaks and mods that you need to do to the config files to get things working. I’ve seen a million pages now with some variation of the following: “Never mind why for the moment, if you’re using CentOS with MySQL and Apache, you need to CHMOD 755 on this particular folder and add this line to the httpd.conf file…”
Think you can escape these problems on Windows? Good ol’ clunky, kludgy Windows that makes everything simple? Wrong. There’s a package out there called InstantRails that you can supposedly just unzip on your computer and have the whole thing running in minutes. Except my spankin’ new Windows Vista machine at the office won’t unzip it, because Vista currently has a problem unzipping zip archives with tens of thousands of files in them. (Update 3/14/07: Problem solved. Downloaded and installed free, open-source 7-Zip instead, which took care of the upzipping in 2 minutes 30 seconds.)
Yes, Ruby on Rails is cutting-edge web development, and I’m not used to sitting out on the cutting edge. RoR has literally only been out for 2 1/2 years. And that means that it’s poorly documented, with most of the available information coming from uber-geeks who’ve figured something out after much trial-and-error and written a hasty post about it on a blog or forum.
Remember what the World Wide Web was like in, say, 1994? Everyone was fantastically excited about it, but nobody was quite sure what it could do. You would see pages that were nothing but prettified bulleted lists alongside pages of enormous graphics taken straight out of a glossy four-color catalog.
There’s a reason why they call it the cutting edge or the bleeding edge. It’s because you feel like you’ve been cut and you’re bleeding. Kind of like you feel after playing football.