Yehuda Katz is a member of the Ember.js, Ruby on Rails and jQuery Core Teams; his 9-to-5 home is at the startup he founded, Tilde Inc.. There he works on Skylight, the smart profiler for Rails, and does Ember.js consulting. He is best known for his open source work, which also includes Thor and Handlebars. He travels the world doing open source evangelism and web standards work.

MythBusting — We Agree! Ruby is Awesome!

With all the disagreement over the past few days, it might seem like Merb and Rails are worlds apart. But David’s latest post demonstrates what I’ve been saying all along: we’re more alike than different.

In the latest installment, he takes on the myth that “Rails is hard because of Ruby”. Effectively, a bunch of people are comfortable in their language of choice (PHP, Java, Perl) and prefer to switch over to an MVC clone in their language of choice than learn the big bad scary Ruby.

As David succinctly argued, Ruby is just not that hard a language to learn. It’s better organized than PHP (with its absurdly large global namespace) and less ceremonious than Java (no IStrategyBuilderFactories here).

And what’s fantastic about Ruby is how quickly and simply new programmers are exposed to advanced concepts like lambdas. Because iteration is accomplished in Ruby almost exclusively with blocks, it’s near impossible to spend even a day in Ruby without learning what blocks are. Spend a little more time with Ruby, and the power of the closures that come along with lambdas becomes obvious. All without the need for an extensive study of the CS benefits of the construct.

Ruby is so easy, in fact, that the slim Learn to Program tome is written using Ruby as a base. It’s so straight forward that my wife, who’s hardly a programmer, was writing a program to count down “99 bottles of beer on the wall” within a few hours of picking up the book (and was even embellishing the program with a few interactive touches :-D )

Finally, implicit in the “I don’t want Rails because it’s Ruby” claim is the oft-heard myth that Ruby is slow. As I explained in my keynote at MerbCamp, Ruby does very well even compared with raw PHP. But when you compare Ruby frameworks (even Rails) against CakePHP, Rails destroys the competition. And Merb does even better. That’s because PHP’s fundamental architecture does not play very well with large frameworks, while Ruby deployment options can manage a fairly large framework with very small runtime impact.

What I showed at MerbCamp was that it was possible to squeeze up to 4,000 requests per second through the Merb stack, or around 1,500 requests per second when going through a controller and template, but that frameworks like CakePHP got only about 100 requests per second, even with a code accelerator.

Bottom line: don’t let anyone tell you that Ruby web applications need be slow. The language itself is certainly slow, but I don’t see a ton of Fibonacci web applications being built, so the real question is about where the bottlenecks are, and Ruby acquits itself very well.

3 Responses to “MythBusting — We Agree! Ruby is Awesome!”

And what’s funny is that now that I’ve fallen hard for the Merb way of doing things, I now love Rails instead of resenting it. RoR is a great fit for a lot of people, but not for me. Competing frameworks allowed me to stay with the language I love and kept me from hoping over to Python/Django for my next project.

Long live Ruby!

Hi, Yehuda. I can add even more to your post. I have compared “hello world” controller for Merb, Rails and Pylons(python framework). And Merb was at first, Pylons at second place and Rails at last. But that was about 3 months ago, maybe today it performs even better.

Pylons was better only in memory consumption (17 Mb Pylons vs 23Mb in Merb).

I would rephrase

“it’s near impossible to spend even a day in Ruby without learning what blocks are.”


“it’s near impossible to spend even a day in Ruby without using blocks.”

What I like about Ruby blocks/procs is that they (can) look enough like Java/C#/C++ blocks that a programmer new to Ruby can learn them even without realizing that he’s beginning to use a new, more powerful concept.

Next thing he knows, he’s using some of the iterators with parameters and it immediately makes sense.

When he finally gets around to learning explicitly about blocks, he’ll realize he’s been using them all along. I love that about Ruby.

Leave a Reply