10.02.07

Why I switched to Rails and back to PHP in one day

Posted in Coding at 12:25 am by David Kellogg

Rails Logo

I love Rails, I think. During the 3 hours and 3 minutes I spent with r0r, I began to anticipate, then love, then loath this simple application. What I expected to be a fun 30 minutes turned into a grueling 3 hours, including a crying baby and a nearly crying back-end developer.

Yes, Ruby on Rails made my baby cry.

I decided to run Rails before deciding its fate in my coding repertoire. I think Terry rejected Rails based on far-too objective reasons of speed and reported scalability. As a sensitive guy, I can appreciate the subjective love people have for Rails. Since Rails is an Ogre, and an Ogre is made of onions, I pealed this onion to see its insides. Here is my minute-by-minute diary.

8:36 fink install Ruby. The assault on Rails has begun. Will it be easy? I don’t know a lick about Ruby. By the way, a ruby is a sapphire doped with chromium. When even a green laser shines on a ruby, it shines with a beautiful red.

As you can see, I had stars in my eyes.

8:38 Ruby is compiliing. Soon this wonderful package will be mine.
8:39 ‘gcc’ running. ‘as’ running. The excitement is building!
8:40 I will skip a straight-off download. Instead I will use ‘gem’.

Little did I know this ‘gem’ would be a 3 hour ordeal.

8:44 gem: command not found
8:46 fink install gem unsuccessful.
8:50 Looking at README. Looks super easy.

That’s the README of gem, and no, it is not super-easy. That was a dumb thing to say. What I did not know was that the very latest gem required a self-update before it could be used. Otherwise, it spews errors, such as command ‘<' not found. Syntax error. Grrrr!

8:52 dirs for models and views. Fools!

This is really stupid. There’s this pattern-like thangy that requires a model, a view, and a controller for every stupid web application. It’s a dumb idea, because it reduces problems sometimes, but always separates documentation of an app into 3 places. What a waste. Some stupid prof probably came up with that MVC thing.

8:56 Ethan just woke up.
9:01 Gave Ethan Mylicon. I hope it helps.
9:15 Ethan back to his mom.

Rails made my son cry. I hope DHH feels sorry.

9:17 ruby setup.rb
9:18 Oops. sudo make me a sandwich.
9:19 Compiling gem. Couldn’t they just write the installer in Perl?

The gem thing is no gem. Gem is the retarted-ruby-app-installer. It’s even slower than YUM, and makes me wonder how fast and scalable their CPAN-like server is.

9:24 ERROR: While executing gem … (Gem::GemNotFoundException)
Could not find rails (> 0) in any repository

Really? Rails not in any repository? Maybe I should just self-update gem first. That totally makes sense, since I just downloaded the latest gem!

10:43 Gave Ethan to Rebecca for his final nightly feeding
10:48 Updating gems. Why does this take so long?
11:42 Checking my Twitter. A PHP guy is following. He’ll be sorry after he finds how I love rails!
11:44 alias rails_hello_world=’rails hello && cd hello && ./script/generate controller welcome hello && echo “Hello World” > app/views/welcome/hello.rhtml && ./script/server -d && firefox 0.0.0.0:3000/welcome/hello’

Rails works! My server is alive! Actually, I do love Rails at this point, but it will all come crashing down in just 4 minutes.

11:48 Time for a stress test.
11:52 100 r0r welcome pages in 13 seconds
11:55 effects.js does not download until prototype.js is done
11:56 apache loads 100 in 5 seconds same Welcome page
00:00 Firebug says 1.82 seconds to load Welcome page in r0r

The truth is free. Rails is sooooo slow. 2 seconds to load a 7kB page is really sad. Prototype.js has to load before effects.js can load. This is a truly horrible app. Apache runs 2.6 times faster in my stress test. I’m sure there are r0r wienies out there that will complain that I didn’t load this or that customary app to accelerate my pitiful speed, but really, out of box, Ruby on Rails is a failure. I’m back to PHP and Apache.

12:52 Now I’ve had 52 minutes to reflect on this application.

Rails suffers from trying too hard. Yes it is easy, despite my wondering through the forest for 3 hours, to install Rails. Its problems of speed and inflexibility show right away. Maybe no one but I noticed the Javascript loading order.

If you wanted to correct something in a framework, you would have to re-write the framework, which destroys the whole point of coding inside the framework. A framework like Rails is like a dictatorship. PHP and library-oriented languages are all about freedom. Perl is freedom. Linux is freedom. Maybe Ruby is freedom. With this MVC trash, Rails is like a straight jacket. Dictatorships and straight jackets serve their purpose, but not in my coding universe.

I can has ur Rails

3 Comments »

  1. Mukunda Modell said,

    October 2, 2007 at 1:27 am

    Long live python on planes.

    sudo make me a railsburger?

  2. David Kellogg said,

    October 2, 2007 at 9:00 am

    My apologies to Mukunda. He commented before I created the lolcat.

  3. jonas james said,

    April 21, 2008 at 12:42 am

    Yeah, you should give Django a try. It’s much easier. Rails 2.0 is even more of a straight jacket than 1.2. Now they not only want everything as MVC, but they want everything RESTful. Talk about shoving stuff down your throat. Rails has gotten very complicated, unfortunately. And so something that could be accomplished much more easily in PHP has to be stuffed into this RESTful MVC thing, with resources and nested resources, and all this crap that basically raises the bar beyond what is reasonable for anybody who wants to dive into a framework. Django by comparison is much simpler and much faster AND it comes with a nice backend. That’s what Rails is missing (instead they gave you stuff that you didn’t need). I regret that I spent so much time on Rails.

    What Rails does have going for it is a nice language. Unfortunately the interpreter is so damn slow. Python is not as nice, but it’s blazing fast.

    Another good option for PHP developers is Code Igniter. Drupal is also a good option depending on what you’re building.

Leave a Comment