Brad's Books and Organizations

Books

Books

Organizations

Organizations

Hi, I’m Brad Feld, a managing director at the Foundry Group who lives in Boulder, Colorado. I invest in software and Internet companies around the US, run marathons and read a lot.

« swipe left for tags/categories

swipe right to go back »

PHP vs. Ruby

Comments (21)

Ever since I started teaching my 15 year old neighbor Ruby (and learning it simultaneously), I keep running into people who ask “why don’t you just learn / teach PHP?”  When I was up in Seattle, I met with Scott Collison who is running a neat company called Ohloh whose goal is to “map the open source world by collecting objective information on open source projects.”  Neat.

Robin Luckey at Ohloh was about to release an article titled PHP Eats Rails for Breakfast.  Before you devolve into the standard flame war with the “PHP is a language; Rails is a framework; you are an idiot” rhetoric, the article is really about PHP vs. Ruby vs. Python vs. Perl.  And – the data (and results) that Ohloh and Robin have put together are fascinating.  Following are the key graphs from the article.

Newlinesofcode

PHP dominates the new lines of code and only PHP and Ruby are on a steady curve upward.  Yeah – I know that “number of lines of code” is not a great measure, but none of these languages are overly verbose so it’s an interesting proxy metric.

Activedevs

Active developers tells a different story.  While PHP is growing a little relative to the others, they all seem to have a relatively flat curve.  The well known shortage of Ruby developers is reinforced by this data, as well as the next graph.

Newprojects

This was the chart I found really interesting.  Ruby is clearly the trendy new language.  Given normal supply / demand lags, you’d expect that this is a leading indicator of a significant uptick for Ruby on the other two charts in 2007.  My conclusion is different than Robin’s – while PHP appears to be dominant today, the rapid growth in new projects in Ruby indicates that it is currently positioned as “the language of the next wave of applications.”  This is consistent with what I’m hearing and seeing from many new startups.

  • http://www.abstract-factory.com Berislav Lopac

    Next time someone starts a flame war with the rhetoric you quote above, you can be sure that they’re an idiot.

    Actually, PHP *is* a framework, just like Rails or Django or Struts; but instead of using a general-purpose language for its syntax, its authors have decided to make their own syntax, based on C, Perl, Java and everything else that seemed useful at a time. This effectively created a new language, but it is still not a general-purpose language like Java, Python or Ruby; it is still too narrowly tied up with its implementation (the only one, despite Phalanger).

    The benefit of this approach is that it’s still the best platform for most Web applications, as it closely follows the way Web works, and doesn’t have to go through hoops to do the most basic things.

  • Dave Jilk

    The second graph shows a net loss of 11% of open source developers during the period. Something must be absorbing it – seems like that’s a notable omission.

    Also seems odd that Java is not included in this set, although Java is not really open source, it’s just free.

  • http://engtech.wordpress.com engtech

    Those are great charts.

  • http://beza1e1.tuxen.de beza1e1

    Hey, you don’t even try to tell, where this data comes from and how it was processed.

    From the link i can tell it comes from “3,000 projects and 220 million lines of [open] source code”. It “can only include projects which are hosted on publicly accessible CVS, Subversion, or Git source control systems”.

    Do you think, this is a good measure for web development? What sites made with Rails make their source code public?

    You can say in PHP is much more need to create new code. That doesn’t surprise me at all.

    Why does Ruby create more new projects, but PHP creates more new code? That is an interesting question and the one raised in the linked article.

  • http://www.startupspot.com Brian Keairns

    A lot of people are getting into PHP because there are so many compelling applications to build on or learn from.

    Just to get in the game, many of those same applications have to be “started” in Ruby.

    If you want get started coding in PHP you have a lot more chocies to build on so you have less reason to start something brand new.

  • http://phpvalue.com netrambler, Alex P

    If I look at google trends for Ruby, PHP, Python, Java and Perl I see quite flat trends, where Ruby made a quite few sharp spikes… It does not seem that people search more for Ruby now…
    Java is growing more even
    Look yourself at google trends
    google trends on prel, php, python, java, ruby

  • http://threebrothers.org Brendan

    Regarding the “New lines of code” metric: when paired with the “New projects” graph, this seems to indicate two successes for Ruby/Rails. The whole “don’t repeat yourself” mentality should theoretically result in fewer lines of code per application than say, PHP; these graphs would support that theory.

  • http://www.psynixis.com/blog/ Simon Brocklehurst

    Brad,

    I’m strongly suspect the statistics you quote are completely meaningless. Why? Because there is something very odd about Ohloh’s sampling. For me, the red flag was that the underlying numbers are so small. For example, take their “New Projects Starts in 2006″ stats. In the raw data, they have only: 12 PHP projects; 11 Python projects; 2 Perl projects; 38 Ruby projects; and 168 “other”. Those are tiny numbers.

    While not perfect as a random sample, a *much* larger group of Open Source projects is available at SourceForge: 7562 Project Starts (with some source code written) in 2006, to be specific; which is 30X Ohloh’s number of 231. The equivalent percentages (New Project Starts in 2006) to Ohloh’s from the Source Forge sample are:

    Ruby 1%
    Perl 4%
    Python 7%
    PHP 14%

    which tells rather a different story. And, of course, the story is even more different if you include langagues other than the ones Ohloh chose to include:

    JavaScript 6%
    C# 8%
    C 13%
    C++ 16%
    Java 23%

    Of course, these numbers are skewed too because there are language-specific places to host Open Source projects that are popular e.g. RubyForge, and Java.net.

    Another way to look at current popularity of programming languages is to look at book sales. See my blog entry:

    http://www.psynixis.com/blog/2006/08/09/oreilly-on-the-state-of-computer-languages/

    This gives a different view again.

  • http://ohloh.net Robin Luckey


    I’m strongly suspect the statistics you quote are completely
    meaningless. Why? Because there is something very odd about Ohloh’s
    sampling. For me, the red flag was that the underlying numbers are so
    small. For example, take their “New Projects Starts in 2006″ stats. In
    the raw data, they have only: 12 PHP projects; 11 Python projects; 2
    Perl projects; 38 Ruby projects; and 168 “other”. Those are tiny
    numbers.

    Yes, I agree that the 2006 numbers are relatively small. However, I do not believe that this makes them meaningless.

    In the article we make only the simple claim that PHP is by far the dominant web-scripting language when compared to Perl, Python and Ruby, and that its dominance has increased over the last few years.

    Even if you disregard our 2006 numbers completely and look only at prior years, this simple conclusion is supported. Other sources of data, which you cite, reinforce this conclusion.

    Although the 2006 numbers are not essential to our claim, I’ll explain them a bit. We did our initial survey of the major forges in the early part of this year, from March to June. So we really have only half a year’s worth of data for 2006. In the last few weeks we’ve opened up the system, and are adding new projects quickly, so over time our database will fill out, and perhaps we can revisit the question.

    Also, as hinted in the article, for this analysis we discounted the first month of activity on any project. This removes much of the “cut and paste” code and filters out projects which have only a single checkin and were then abandoned. Because all of the 2006 projects are young, some of them still haven’t had a second checkin, so our analysis discounted them.

    While not perfect as a random sample, a *much* larger group of Open
    Source projects is available at SourceForge: 7562 Project Starts (with
    some source code written) in 2006, to be specific; which is 30X Ohloh’s
    number of 231. The equivalent percentages (New Project Starts in 2006)
    to Ohloh’s from the Source Forge sample are:


    Ruby 1%
    Perl 4%
    Python 7%
    PHP 14%

    The SourceForge numbers also support our simple claim that PHP is by far the most popular web scripting language, and is still growing.

    Here at Ohloh we jump-started our database by trying to bring in the most popular projects from several major forges, including SourceForge. What we found is that although these sites claim enormous numbers of projects, the vast majority of these projects die very quickly. Many of them have no code, and the majority of them are tiny projects that have only a single developer, who often never checked in more than once. Our resources are limited, so we didn’t bother gathering this very long tail of inactive and forgotten projects. This may skew our data, but I don’t believe this type of culling disproportionately affects one language more than another.

    Of course, these numbers are skewed too because there are
    language-specific places to host Open Source projects that are popular
    e.g. RubyForge, and Java.net.

    Yes, Ruby is under-represented on SourceForge. The Ohloh database does include the majority of projects from both RubyForge and Java.net. And again, many of these projects are abandoned or contain only a single checkin. However, this does broaden the coverage of our data to include more non-PHP projects. And yet, even after including these other forges, the volume of PHP still dominates.

    Another way to look at current popularity of programming languages is to
    look at book sales. See my blog entry:

    http://www.psynixis.com/blog/2006/08/09/oreilly-on-the-state-of-computer
    -languages/

    This gives a different view again.

    This is an interesting chart, but I don’t believe it presents a very different view. PHP is evidently still outselling Python, Perl, and Ruby in terms of new book sales. The charts shows that Ruby’s popularity has increased recently, and our charts may be hinting at the same thing [and we sure love Ruby here at Ohloh -- we used it to build our application]. None of this seems contrary to our basic claim about PHP’s growing popularity.

    Although the Ohloh database is not yet comprehensive, I’m very excited that we are doing something no one else has done before. Rather than measuring secondary effects like web trends and book sales, we are measuring something that is much closer to the truth about open source: we are measuring the actual lines of code produced by developers.

    We are trying to bring ultimate transparency to the world of open source development, and that includes complete transparency in our own numbers. I’m eager to address any particular questions you have about our data, and we welcome feedback.

    Thanks for your interest,
    Robin Luckey

  • http://www.psynixis.com/blog/ Simon Brocklehurst

    Robin,

    Sorry – I should have been more specific in my comment. What I wrote in the first paragraph of my comment was inaccurate. I actually didn’t mean to say that *all* the stats that Brad quoted from your article were meaningless – I don’t think they are.

    What I should have said is that I thought that the “2006 New Project Starts” numbers are probably meaingless, because of the very small sample size.
    I stand by this. However, I agree with you that these numbers don’t affect the conclusions of *your* article. I wasn’t meaning to suggesting that they did. I was making a comment on the “2006 New Project Start numbers” because these were there ones that Brad seemed to be most interested in.

    I like the work you’re doing. As you say, because you have the ability to look at actual lines of code, you can definitely bring some unique insights to the table. One thing I’m curious about, though, is why you didn’t include Java, JavaScript and C# in your article. These are all relevant to web-based programming – perhaps more-so than is Python.

  • http://www.ashnah.com ashraf

    I am working on a new project ashnah internet server. more like xampp.
    ashnah php interpreter withh built in dabase and everything. not for professional but any project done with ashnah frame work can be move to another locaion as ashnah is a simple interpreter and simulator for php, mysql, apache.
    please visit my http://www.ashnah.com site and make comments.

    thanks

  • Johnny Bopp

    Ruby will supplant PHP, huh? is that why IBM and Oracle have thrown in with the keeper of PHP, Zend, and developed individual full-stack development environments for PHP but not for Ruby?

  • ytk

    Where did you find this chart? I want to see updated chart to 2009 or 2008.

  • http://whatsacoder.blogspot.com What's A Coder?

    I've programmed with ruby on rails first before php and ruby on rails was easier compared to php. I had a hard time with php now since i'm used to program in ruby. but still i got no choice.. in my place Ruby is not that popular yet. but i'm still a ruby fanatic…

  • http://www.technokyle.com Kyle

    Ruby on Rails Deployment is getting easier now since most hosting companies are adding RoR support

  • Greg

    Ultimately, though, all the different metrics in the world come back down to one simple thing:

    You need to look at each language, you need to look at which one has the features you need, and you need to decide which one is the best way to go. PHP, Perl, Python, Java, C#, Cold Fusion… you have to look at which one supports the environment you feel comfortable with, which one gives you the features you need, and which one you will be most productive with. I haven't found reason yet to switch personally to PHP, and I don't think that any of these languages is likely to go away soon, so if it's the best language for me, it's the one I'll continue dealing with.

    There's no wrong answer, only an answer that's most right for your development needs and goals.

  • Mike

    Programming is programming. The site itself is the goal. You all remind me of the mediocre student in grade school that was obsessed with her handwriting.

    C# and Java are superior languages in terms of performance. Ruby (on Rails) and PHP (on a framework like CakePHP) are similar. Both slow but they make the lives of developers easy, which means developers work faster and clients pay less, which makes them happy.

    Bottom line, if you're making what you believe will be the next Facebook, then use C# or Java (or PHP if you want ease in exchange for performance – Facebook uses PHP). If you're making a "Things to Do in Wichita" site, for example, scalability and performance don't matter and you can finish it in Ruby on Rails or CakePHP in half the time.

  • http://www.contussupport.com Php Programmer

    PHP is really no match to Python. I have been PHP developer for 3 years and switched to python because i feel Python is more like a hybrid language. Because of python flexibility features i can easily scale.

  • http://bit.ly/cQBCDm Stuart Liroff

    Brad, great statistics! Do you have new data? Do you have pointers to discussions re: why use PHP, Python and/or Ruby. Are there reasons why an engineering team will choose one or the other?

    • http://www.feld.com Brad Feld

      Sorry – new new data from me. My guess is there is plenty of debate on the web about this at this point.

Build something great with me