Although PHP Eats Rails For Breakfast

Ohloh is a stalker for open source projects. These guys can discern tremendous amounts of data about any code that has public version control. Pretty nifty.

Now according to Robin Luckey’s report, PHP has seen 20% growth in terms of LoC; code written in Ruby simply dwarfs in comparison. Though I have a strange feeling about this.

I believe that this year, and the one to follow will put Ruby (and especially Rails) where PHP was back in 2002-03; in a sense Ruby will enjoy the growth in popularity and adoption the same way PHP did. But putting aside technological merits, I think that there’s a categorical difference between most code written in PHP and that in Ruby… in a Apple vs. Microsoft kind of way.

For starters, Ruby (and especially Rails) tend to spoil developers. The minimalistic approach of both the language and the framework affects the developers’ mindset, and makes them, even forces them to write more concise code. PHP has a history of ugly code, amateur software and “failed” frameworks. So the code produced by most PHP’ers would have a much larger LoC value than similar code produced by Ruby’ists.

In addition to that, most projects written in Rails are service-oriented: not open source, no public code repository, and no way Ohloh can analyze them. Most of the Ruby code that Ohloh can analyze comes from RubyForge, which accounts for most projects written in Ruby, and none of those, relatively speaking, have a large code base.

I neglect the effect of 37signals’ product design and marketing approach, though I know it’s in the back of every Rails developer’s mind. Most sites built with Rails are usually simplistic, and don’t require much code in the first place. And even if Ohloh had access to these sites’ code, they wouldn’t see much growth anyway, because once a service-oriented site is complete, feature-additions will only account for a thin slice of its growth.

Remember, the numbers on Robin’s report are those of growth not of total LoC. That is, PHP has grown by 20% even with Rails’ influence over web developers. I can only find two reasons for that:

  • PHP code is inherently more verbose, thus generates more lines of code.
  • Developers prefer switching frameworks than switching languages.


2 Responses (Add Your Comment)

  1. I must say i totally agree. The structural constraints of rails in combination with the syntactical flexibility of ruby force a developer to write less and better code. It’s also allot easier to have a fully tested and documented application with rails then it is with CakePHP (or any other PHP framework for that matter).

    Reply ↵
  2. I can’t say Rails forces us to write necessarily better code, but it’s always less than comparable frameworks.

    It’s just that, in most application, the code of Rails itself is what accounts for 80-90% of the total code, and that’s probably why we don’t see much code growth in Ruby.

    Reply ↵

Leave a Reply

Formatting: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Other Entries

Tweets from