Ohloh has a piece comparing PHP, Ruby, Python, and Perl. Of course, PHP ends up coming up on top in their assessment. However, upon closer inspection, I believe that their assessment is quite flawed.
Lines of code
The first metric they use is total number of new lines of code. This also happens to be the main metric they use for the basis of their whole conclusion. At first glance, this seems like a good thing. A lot of new lines of code means a lot of interest in the language. As you can see, Ruby has barely any new lines of code…the graph is nearly flat, with only a small rise at the end. However, I think we should dig a little deeper.
The second metric they measure is the total number of active developers. PHP and Ruby both get minor net increases here from 2001-2006. There isn’t too much else to say about it, and both languages come out about equal in this department.
The third statistic measured in this sample was the number of new projects in a given year. In this department, Ruby destroys PHP. Ohloh seems surprised about this, but I don’t find it the slightest bit surprising. If anything, this just goes to prove how much Ruby shines.
Well, we see that PHP has a rapidly increasing amount of code being produced with it. However, we’re not seeing as many new projects being created with it. Ruby on the other hand is doing the exact opposite, very little new lines of code, a lot of new projects. I think this boils down to the fact that the majority of people developing PHP applications don’t use frameworks to increase code reuse, cut down on redundant code, or ease maintenance. In other words, these PHP developers are reinventing the wheel every time a new project is produced, rather than having a framework with all the previous work done at their disposal. Ruby developers on the other hand tend to always use a framework. This is probably due to the fact that the whole reason for Ruby’s current popularity is Rails, a well designed, extensible web framework that really cuts down on redundant code, and really aids in code maintenance and reuse. So, Ruby developers are leveraging existing code to produce several projects in less lines of code, because they’re leveraging existing code with every project (and often, these projects give back even more code to Ruby and Rails in the form of gems, plugins and engines). So really, all this statistic proved is that developers should start using frameworks instead of building applications from scratch if they wish to get the most productivity out of their time.