Skip navigation.

Is Ruby brainwashing us?

Bruce Tate recently wrote a book "Beyond Java" that is critical of Java and praises Ruby excessively. The book has very few positive things to say about PHP.

Well, my personal preference in terms of language is a simple clean C-like syntax. I want something that I can teach programmers in 2 days. I don't want an unfamiliar syntax that requires relearning a lot. I don't want programmers to agonize for hours on the right way to code something new. That's why I don't particularly like Ruby's syntax (though i admit i am a novice at Ruby). In contrast, PHP is basically C (or C++ or Java) with $ signs in front of variables - it's that easy.

You want clean coding? Well K&R code formatting works just as well with C, C++ and PHP.

Large scale programming? The principles you used in software engineering with applications developed in C apply just as well to PHP!

Recently, on Mike Naberezny's blog, I saw the following code comparison:


to = %w(Paul Matthew Daniel)
loop do
  from = to.sort_by { rand }
  pairs =
  next if pairs.any? { |t, f| t == f }
  pp pairs

$from = $to = array(‘Paul’, ‘Matthew’, ‘Daniel’, ‘Andi’, ‘Chuck’);
for (;;) {
    foreach ($from as $i => $f)
        if ($to[$i] == $f) continue 2;
print_r(array_combine($from, $to));

As you can see, for this example, Ruby and PHP are about equal in power of expressiveness, but I suspect that a Java or C programmer would comprehend the PHP one faster. And PHP functions such as strpos() and strcmp() make switching from C much easier. We even have an ADO compatible db class library for developers with an ASP background, and I believe some people are trying to clone jdbc. All we need now is for someone to implement a clone of the java string library and we are all set to win everyone over :)

I do admit that Ruby appears to have some features that would appeal to Smalltalk fans, but that remains a small minority. Ruby on Rails is nice, but I think my company's inhouse PHP framework is more powerful, other people are coming out with equally powerful open source PHP frameworks.

I'm glad I'm not the only one who feels that way. Bruce Eckel, a well-known Java and Python expert, also feels that Ruby is over-hyped:

I think we've mostly been hearing from people who have come from Perl and found Ruby to be a "better Perl, with objects that work," or people who are finally convinced that dynamic languages have merit, and so mix the enthusiasm of the first time dynamic language user (quite a rush, as I remember from my 2-month experience with Perl many years ago) with their experience of Ruby.

To my surprise, Bruce adds:

I've been bumping up against the problem of "but all I want to do is connect a database to the web" in Zope2 [a popular Python framework] for several years now. Oh, it's definitely something you can do, but unfortunately it's past the knee of the "Z-shaped learning curve," and is only trivial if you live and breathe Zope every day.

Don't get me wrong; Zope is an excellent system and incredibly powerful, and Zope3 may be much easier, but I'm out of steam. I have realized that on my site, I really just want to do a collection of simple things, and I don't want to relearn Zope every time I want to accomplish something... -- I'm going to find something drop-dead simple to solve my drop-dead simple problems. Probably PHP5, which actually includes most of Java and C++ syntax, amazingly enough, and I wonder if that isn't what made IBM adopt it.

PHP continues to gain momentum...

PS: Also see what Sam Ruby, one of the core PHP developers and implementor of the first PHP to Java bridge, has to say about Beyond Java.

PPS: Added 22 Dec: Also see Tim Bray's point of view.