Professional PHP

PHP Programming, Web Development, PHP Advocacy and PHP Best Practices.
« A WordPress bug fix
Backward compatibilty and web host adoption of PHP 5 »

Why isn’t PHP the natural successor to Java?

September 29th, 2005

Loud thinking declares that Java has lost its aura of invincibility. Jason Hunter sums it up nicely:

Ruby on Rails today looks poised to eat Java’s mindshare on the web tier. If not Rails, then something else.

It does seem like Java’s mindshare is on the decline, along with sun’s fortunes. There is some evidence that rails is drawing mindshare from PHP as well. (Mind share is the grown-up way of saying “what the cool kids are doing.”)

So why isn’t PHP that something else?

i think its the unit testing, “You aren’t gonna need it,” “Do the simplest thing that could possibly work” folk that are dismantling Java’s mindshare. As they gain it, Java loses it. Some of that is showing up in the java community itself in concepts like POJOs and dependency injection. Some of it shows up in an exodus from Java to dynamic languages.

So why are the agile leaders like Martin Fowler and Dave Thomas working with Ruby instead of PHP? David Heinemeier Hansson directly credits these guys with influencing his decision to stop programming rails in PHP and move to ruby. I suspect that its the dynamic, smalltalk, like features of Ruby that appeal the the agile methods leaders.

Rails could have been a PHP framework, but wasn’t. Although, I’m not sure that it would get the attention it is if it were a PHP framework. The rails, ruby combination may be greater than the sum of the parts.

I can’t speak for anyone else, but I have some ideas about why PHP might not appeal to the agile method and java is too complicated folk:

  • Too many globals – globals make unit testing more difficult and prevent integrating work from different developers, let alone different organizations.
  • No culture of objects – PHP has made great strides in this area, but I don’t get the impression that many of the folk that work on and with PHP really buy into object oriented programming the way that the agile methods folk do.
  • Crowded namespaces – How many functions is PHP up to? Constants?
  • incomplete component model – This is another integration thing. PHP has too many islands and not enough continents. (I’m talking beans here, but definitely not EJB.)
  • No mature frameworks – Ruby has been around a long time, but didn’t really start gulping mindshare until Rails came along. See The Value of MVC.
  • No closures – Its a dynamic thing.
  • Expert level gotchas – hopping on the learning curve is easy. Reaching the top, not so much.

I’ll elaborate on each of these points in a series of upcoming posts.

I’ll close by saying that life is not a zero sum game. The success of Ruby and Rails does not diminish the success of PHP. The cool kids were doing Java and now some of them are doing Ruby. Oh, well. Its disappointing that more of them aren’t doing PHP, but PHP has many things going for it. That, however, is a different series of posts.

Filed Under

  • Agile Methods, PHP

Related Posts

  • PHP Book sales trends versus Java and Ruby
  • Programming Language Trends via Google
  • Crazy Zend PHP Framework Rumors
  • Comparing PHP with other languages
  • Delicious Outage Link Dump
Both comments and pings are currently closed.

23 Responses to “Why isn’t PHP the natural successor to Java?”

  1. Christopher Thompson says:
    9/29/2005 at 1:30 pm

    I think that the recent thread on Sitepoint is much more a microcosim of why there is a dearth of things like Rails in PHP. It is a difficult to create standards that appeals to a large group of PHP developers because of our diverse backgrounds. And the bigest divide in PHP is from those coming from Java/.NET and those who do not.

    There is also a major flaw in your premise. Java is primarily used for coporate web development and as a general programming language. PHP one the other hand is a language that has allowed millions(?) of people, from non-programmers to enterprise developers, to build web applications. So you have a bunch of domains here and you haven’t indicated specifically which one(s) you are talking about.

    I think you are specifically addressing the group of developers for which something like Rails solves problems in the domain in which they program. I would say that a better analysis is that Rails meets the needs of developers who are not well served by Java or PHP because their application are not so large or so small as to fall neatly into those camps. And that the purer OO of Ruby has an appeal to those with strong OO opnions.

  2. Harry Fuecks says:
    9/29/2005 at 2:46 pm

    Perhaps another point against PHP is it doesn’t really free you from C the way languages like Perl, Python and Ruby try to.

    Consider Perl’s LWP (http://cpan.uwinnipeg.ca/module/Bundle::LWP) for example – at a guess it may be the most widely used networking API in existence and the layer your scripts will interact with are all written in Perl. Can think of many similar examples.

    But PHP is a different story. Yes there are good libraries written in PHP but I can’t think of any that have the relative acceptance of something like LWP. What library API, written in PHP, is everyone using? Perhaps the closest is Johns ADOdb but still not everyone’s taste – by contrast, although perhaps not a fair comparison, DBI is effectively the only way you’d talk to a DB in Perl (of course DBI isn’t all Perl – PDO is closer to DBI).

    Essentially if you want to write an library / API that PHP coders will adopt, you have to do it as a PHP extension.

    Reasons numerous but when you consider fundamental silliness of http://www.php.net/soap (which is in itself useful), arguments about performance fly out of the window (who cares about 0.1ms here or there when you’ve got network latency?). PEAR::SOAP was way more mature when ext/soap got under way. Even wierder side note is ext/soap never spun off an HTTP client API, despite having done that from scratch as well (http://cvs.php.net/co.php/pecl/soap/php_http.c?r=1.78).

  3. Thorsten says:
    9/29/2005 at 5:32 pm

    Not meaning to gain any credits here, but you may want to take this into account for your future ellaborations: There is a project called Cucua (http://cucua.tigris.org); it’s goal is to provide an enhanced class library for PHP5 based on the public Java API.

    And about that ongoing Ruby vs PHP discussion (which has become a hot topic since Rails): For sure, the main reason for Ruby’s success regarding web development are the enhanced language specific functions implemented in Ruby which can make the developer’s life somewhat easier. I’m sure PHP could keep up with this, but I somehow have the feeling that PHP is right now split up into two divisions: The community, which proposes suggestions on how the language itself should change to extend the functionality and the handling of the new OM, and the core developers themselves who seem to act kind of bulky regarding those feature requests.
    This might be OT, but if PHP wants to keep up with Ruby and does not want to become “your regular scripting language on a shared host”, then I see a strong need in a better community process and even more communication between the hardcore users and the core developers…

  4. villatrauma » php, java, ruby says:
    9/30/2005 at 12:36 am

    [...] interessante gedanken auf Professional PHP … welche sprache folgt auf java, warum ist php nicht für die agile entwicklung geeignet, wo liegen rubys stärken … ? [...]

  5. Oak Nauhygon says:
    9/30/2005 at 1:16 pm

    So why are the agile leaders like Martin Fowler and Dave Thomas working with Ruby instead of PHP? …… I suspect that its the dynamic, smalltalk, like features of Ruby that appeal the the agile methods leaders.

    Shouldn’t badmouth the language of my choosing, but cannot agree more on this one. :) PHP certainly lacks the meta-programming (or if you wish “high-order programming”) power that Ruby, Phython, or even Javascript has.

    The new object model in PHP5 certainly got us excited for a while, but the overall funtional programming gadgets are still missing (or may never come handy). The new reflection API and tokenizer extension (and perhaps also the classkit extention) may rescue us to a limited extent but all that does not amount to a nifty solution.

    That said I am still a PHP lover. Proof is EZPDO. :)

  6. Philippe Lachaise says:
    10/3/2005 at 4:08 am

    I was a PHP enthusiast for a couple of years, to the point of developping yet another PHP object framework.

    I stumbled on ruby on rails not on the web, not even in a technical magazine, just in an article of an ordinary news magazine (French Courrier International) !

    Looked up on the web, bougth books, got hooked.

    With PHP I had to bend the language to build an OO framework (names conflicts control !) and experienced the fact that apart from not having to worry about pointers code is pretty much like C++ (I do love C++, but not for Web dev.).

    In contrast Ruby looks like a mature OO language and rails is what my framework should have been had I entirely succeeded (blame on me not PHP ;-) . So It looks like the natural point where to start again from.

    Though I could havelived with the language’s shortcomings be the lack of consensus around one OO framework (or a reasonably small number of them) will cause PHP to loose its momentum.

    Now what has alredy started to happen is migration from PHP ro rails : keep the DB schema ans rebuild the rest thanks to ActiveStore.

    So I’m afraid the problem with PHP is first ans foremost a fragmented community (procedural old-timers vs agile OO developpers).

    The era of NukeXXX is coming to an end, what’s thefuture of the blue elephant ?

  7. volldamm.net » Articles interessants says:
    10/3/2005 at 11:32 am

    [...] Why isn’t PHP the natural successor to Java? [...]

  8. Professional PHP » Blog Archive » Crazy Zend PHP Framework Rumors says:
    10/17/2005 at 10:16 pm

    [...] A Rails clone? It would be pretty obvious who the competition is then. [...]

  9. Julik says:
    10/24/2005 at 11:24 am

    I don’t know exactly but coming from PHP to Rails I can say a few things why I switched

    1. I hate writing boilerplate code
    2, PHP is very verbose
    3. The OO features put in look like they are made to set a point for the Big Execs that “PHP is like Java”, not to be convenient.
    4. I appreciate that you don’t have many concurrenting projects in Ruby and quite some class (compare PHPDocumentor and rubydoc, or PEAR and rubygems – not only as technologies but by mindset).

  10. PHP Book sales trends versus Java and Ruby | Professional PHP says:
    12/8/2005 at 12:07 pm

    [...] O’Reilly radar has an interesting graph of 2004 versus 2005 book sales for a variety of languages. The big news is that Ruby books sales are up 1552% and Java book sales are down 4%. This would be consistent with my observations from Why isn’t PHP the natural successor to Java. A small cadre of agile minded developers are giving Ruby a spin. [...]

  11. Delicious Outage Link Dump | Professional PHP says:
    12/19/2005 at 11:22 am

    [...] The departure of the hyper-enthusiasts – “The Java hyper-enthusiasts have left the building” (along the lines of this.) [...]

  12. Building a culture of objects in PHP | Professional PHP says:
    1/13/2006 at 12:42 am

    [...] This is a follow up post to Why isn’t PHP the natural successor to Java? [...]

  13. Programming Language Trends via Google | Professional PHP says:
    5/10/2006 at 7:54 pm

    [...] PHP seems to be holding steady, or slightly declining. But, Java is waning, as I discussed in Why isn’t PHP the natural successor to Java?. C# seems to be steady and slightly increasing, while Perl is steady and slightly decreasing. So where are those Java programmers going if not PHP? Are they going to Ruby and Ruby on Rails? [...]

  14. Comparing PHP with other languages - Professional PHP says:
    3/1/2007 at 12:08 pm

    [...] I don’t disagree with the cultural grouping. PHP’s cultural heritage is definitely in the Unix programming, C/Perl camp as I suggested in building a culture of objects in PHP and Why isn’t PHP the natural successor to Java? [...]

  15. Pula Web says:
    5/7/2007 at 2:56 am

    I don’t agree with Julik on PHP verbose interpretation. Readability of the code depends mainly on the individual programmers. Documentation of Rails is not good. Must say that Rails framework is nicely done but if you take look from business side you will still go with PHP. Eventually, Rails is very good but not mature enough and framework is not that popular.

  16. andrea says:
    2/1/2009 at 10:47 am

    I think, as stated before, that most of PHP programmers do not use OOP and you have not some tools like EJBs and containers.
    But PHP is still one of the fastest programming language i think.
    I hope someone would improve these aspects in PEAR APIs, or something.

  17. Delbert says:
    9/9/2010 at 12:53 pm

    Thank you for taking the time to discuss this, I really feel strongly about it and love learning far more on this topic. If possible, as you gain expertise, would you mind updating your weblog with a lot more info? It is incredibly helpful for me.

  18. king james bible says:
    1/31/2011 at 10:16 pm

    I don’t normally publish but I enjoyed your blog site a great deal.

  19. uzamax says:
    3/6/2011 at 10:54 am

    %100 Do?al ve hiç bir yan etkisi olmayan Uzamax’? ke?fedin
    UZAMAX içeri?inde mineral ve vitaminler bar?nd?ran, do?al bitkielerden üretilmi? g?da deste?idir. ?çeri?inde herhangi bir kimyasal ürün bulunmamakla birlikte tamamen do?al kurutulmu? bitkisel bir kar???md?r. Sadece birkaç ayl?k kullan?m kürü sonras?nda bile uzamax’?n etkisini hissedeceksiniz.

    Uzamax kullanarak do?al yollarla bünyenize gerekli olan tüm besin, vitamin ve mineralleri vücudunuza alman?z? sa?lar.izlanda yosun hapi

  20. rheumatoid arthritis cure says:
    5/17/2011 at 2:52 am

    Can I just speak what a elimination to locate superstar who really is aware of what theyre talking relating to on the web. You completely recognize learn how to carry an matter to gentle and construct it significant. Extra people must learn this plus perceive this side of the narrative. I cant imagine youre not more popular because you positively have the gift.

  21. Karlsruhe, Frank Lange says:
    9/24/2011 at 3:03 pm

    I do not agree in all parts of your argumentation, but overall it’s a real good article with lots of meaningful thoughts. Thank you, Frank

  22. Mike says:
    9/28/2011 at 6:18 pm

    There is no way Rails could have been written in PHP.

    Yeah, PHP has some weak wannabees, but they don’t come close to Rails.

    Rails is in Ruby because Ruby has the best metaprogramming support of any language outside of Lisp. PHP has basically none. Java has none, Python has a little, Perl has some, Smalltalk definitely has but its syntax isn’t as friendly as Ruby’s.

    Scala and Haskell could have, but most don’t like functional languages.

  23. Morton Rishel says:
    12/27/2011 at 4:00 am

    You just know that Obama is starting to slide when Chris Matthews has lost the tingle in his leg. He is in a rudderless boat and the media can’t even help him. Bye Bye Bama.

    Subscribe Feed
    Share Subscribe to this blog…
    Share Bookmark or share this page…
  • About

    My name is Jeff Moore. I'm a PHP programmer living in San Francico and working for a startup.

    More about me…

  • Categories (Home)

    • Agile Methods (14)
    • Mac (14)
    • Misc (18)
    • Open Source (14)
    • PHP (99)
    • Software Design (29)
    • Usability (14)
    • Web Design (20)
  • Recent Comments

    • rsync to remote server via ssh  37
      Petr Halounek, Penni Tomasino, Rodney Kohnen [...]
    • WordPress BBCode Plugin  30
      wepniveth, Pamella Philipps, evakuat [...]
    • PEAR Templates  18
      Sang Bellotti, Kandice Sansing, car insurance estimates for teenagers [...]
    • Extreme Simplicity  15
      Gilbert Moatz, Roni Beauregard, Barb Geyer [...]
    • Manual Memory Management is Dead  6
      Grass Fed Filet Mignon, Kellie Carello, PAPANDOR [...]
    • Friendster wrapup: does MySQL scale  38
      Ollie Joya, nfl jersey on sale, selling scrap gold [...]
    • The Coding Apprentice  51
      fkawau, Annamae Mccane, Boca Raton Personal Injury [...]
    • The Legality of Republishing RSS Feeds  30
      dasfdsfsd, reebok authentic nfl jersey, Tory Rennemeyer [...]
    • Exceptional PHP  7
      Sports, The Click, Laraine Waterhouse [...]
    • PDO versus MDB2  42
      selling silver coins, Oliver Luongo, ddkoaorpa [...]
  • Recent Posts

    • Richard Thomas
    • ZendCon: Writing Maintainable PHP Code
    • Looking Towards the Cloud
    • Holiday Tech Support
    • Closures are coming to PHP
    • php | tek Wrapup
    • php | tek 2008
    • Sarah Snow Stever
    • Benchmarking PHP’s Magic Methods
    • The Endpoints of the Scale of Stupidity on Video
  • Site

    • Archives
    • Log in
  • Search