Sunday, September 10, 2006

Ruby vs PHP by David Heinemeier Hansson

It sounds like an excellent idea to have some side-by-side comparisons of Ruby and PHP. I'll try to cook up some good examples shortly and post them to Loud Thinking.

On doing maintainable development in PHP:

It is certainly possible to do both object-oriented and maintainable development in PHP. I did just that for more than a few years. Rails is built on principles I realized and used in PHP.

Most languages has a sweet-spot, though. A range of tasks it does better than any other language. Building MVC-style web-applications with an attempt to foster a reusable framework isn't the sweet-spot for PHP. As I said, it's doable, but I found it much more painful than doing the same in Ruby. Likewise, I probably wouldn't use Ruby for a quick little thing little adding some level of dynamics to the 37svn blog. PHP has a sweet-spot for getting simple things working really fast and on a ton of web-hosts. The longer you move beyond that sweet-spot, the more painful it gets. (PHP5 moves this sweet-spot closer to my needs, but still falls way behind Ruby—in my ever humble opinion).

On finding Ruby:
I've long been an admirer of both The Pragmatic Programmers and Martin Fowler. The former wrote the seminal The Pragmatic Programming, many brilliant articles for IEEE Software and latest the Pragmatic Starter Kit. The latter wrote Refactoring, Patterns of Enterprise Application Architecture, and a range of other interesting books.

Both the Pragmatic Programmers and Fowler had used coding samples in Ruby to illustrate programming lessons and in general talked with much fondness about this all object-oriented language with unrivalled elegance. This lead me to Programming Ruby, which in turn introduced to a community of immense devotion to this language with Japanese roots.

And now I truely appriciate why Ruby programmers hold the language in such high regard.

David Heinemeier Hansson

22 Mar 2004

No comments: