Wednesday, November 28, 2007

The Future of PHP

source : Marc's blog

Marc says :

Last Friday there was a rather spirited discussion at the office between Kaiton (a Ruby aficionado and ex-Panmedia employee currently at Microsoft), Nesta (a python aficionado who is forced to use PHP) and myself, (an un-biased PHP user who is forced to defend it ;-). The topic of course was PHP, its woes, its past, its present and its future.

According to Kaiton, PHP will be marginalised in 2008 by more literate programming languages like Ruby, Python and even Erlang. His view is that as the web becomes more important to business, backend programmers will start to get involved in the front end and web programming will be dominated by more experienced programmers who care more about the language they code with. According to Nesta, Drupal is the only good thing that ever came out of PHP. I think that 2007 will be the year of PHP.

By the end of the argument discussion, things were kinda starting to go around in circles so I decided to try and articulate my ideas in written format so that they could be dated, critiqued and openly ridiculed, and so that a year or two from now I can come back read the crazy things I was thinking way back in 2007. It will also serve as an official record in case Kaiton wants to put his money where his mouth is ;-)

Before I present my argument, let me get a few things straight.

There are definitely some dislikeable things about PHP. The language design (or lack thereof) is far from perfect. PHP’s roots and a laissez-faire approach to adding new features early on have scarred the language with inconsistent naming conventions and function behaviour. A late start in the object oriented game meant that it took them a little while to get that feature right. Its popularity has been its Achilles heel and prevented the developers from making radical sweeping changes to normalize the language.

On the flip side there are a few unfair assertions that people tend to make against PHP. I often hear people say “you can’t build large apps in PHP, it just gets messy!”. While there is a lot of bad PHP code out there, that doesn’t mean you can’t write clean code. The PHP language does not enforce a lot rules to prevent you from coding sloppily; whether or not a language should police coders is a separate matter of debate. The fact remains however that PHP provides you with everything you need to code your applications according to tried and true Object Oriented Design Patterns. Whether or not you choose to do so is up to you.

Just so it is clear, I am not saying that PHP deserves to prosper, I am not saying that I personally want it to prosper, I am simply saying that it will prosper. Here is why:

PHP is popular. This has a couple ramifications.

  • PHP 4 is available by default in just about any web-hosting plan you come across. And PHP 5 availability is rising steadily.

  • It has been widely and heavily tested against a multitude of different environments and configurations (Hardware, OS, Database, 3rd party software, etc).

  • You are much more likely to have somebody in-house who knows at lease some PHP than any Ruby or Python, and it is also much easier to hire a PHP developer.

PHP 5 is “good enough”.

Regardless of what you want to say about PHP’s language design (or complete lack thereof) as it currently stands at version 5.2:

  • It has sufficient object oriented features for coding according to enterprise patterns.

  • It has deprecated the magic functions (register globals, magic quotes, etc) that have been the source of many security issues in the past an scheduled them for complete removal in PHP 6.

  • The Internet’s most trafficked site is built using PHP. They are heavily invested its success and are one of the major driving forces behind the PHP 6’s upcoming Unicode support. They have a presentation online explaining their rationale for choosing PHP.

This meets my definition of good enough. Far from perfect, not necessarily the best, but good enough for web work of all sizes.

The PHP Collaboration Project makes PHP better.

  • The Zend Framework leads by example to help solve the sloppy PHP coder epidemic and give developers a solid basis for rapid application development.

  • The Zend Developer Zone plays in important role by engaging the community and providing example code.

  • However, to me, the most important part of the Collaboration project is the new Eclipse based IDE/Debugger. A well designed, fully integrated free and open source graphical coding/debugging solution for PHP will a major step forward for web application development. One year from now many of use will scratch our heads in amazement at the primitive methods we used to employ for debugging complex web apps. The difference will be as huge as the jump from debugging JavaScript using alert messages to using Firebug 1.0 (more on that in a later blog post).

Zend knows how to compete

From a developer point of view the entire PHP Collaboration Project is an attempt to compete with ASP.NET. The combination of a Developer Zone, an IDE and a Framework are straight out of the Microsoft playbook. They are even working with Microsoft to compete in the arena where Microsoft typically dominates… distribution to the windows desktop. Zend Core for Windows will be a simple download and install and I wouldn’t put it past them to bundle the framework in as well.

On the Framework level the Zend Framework competes with Ruby on Rails, Django and ASP.Net. It covers all the typical bases MVC, ORM, Caching, JSON, etc.

On the language level PHP 5’s object-oriented improvements and PHP 6’s upcoming Unicode support give the language some more “enterprise” features, but I don’t think Zend is actually trying to compete with Java. Zend and Sun’s collaborated on JSR-223 (Scripting for the Java Platform) which will allow scripting languages like PHP to access Java objects in the recently released Java 6 JRE. When you combine this with the Java language support in Zend Studio 5.5 it indicates to me that Zend wants to co-exist rather than compete with Java.

Zend is making inroads into the corporate world

Separate and apart from working with IBM, Intel, EBay and Amazon on the collaboration project, Zend has established partnerships with the major proprietary Database vendors and created a special set of PHP distributions just for them called Zend Core; this now includes Zend Core for Oracle, and Zend Core for IBM . Not only do these types of partnerships make companies feel more comfortable using PHP with the proprietary databases they have built their business on but they also offer a number of other benefits:

  • Improved drivers. By working directly with the database vendors, Zend has already made numerous improvements to the PHP extensions for Oracle and DB2.

  • Simplified distribution and setup for those who need to use proprietary drivers (since they aren’t distributed with the standard php.net download).

  • GUI based management. Each Zend Core distribution comes with a web based interface for viewing the server status and managing the PHP configuration. Zend Core also comes with an updater that allows you to easily apply and rollback PHP updates.

  • Zend Core provides a nice smooth on ramp to support. You can download the basic system for free and then choose your level of support later on. Support for PHP may not seem necessary to most developers but it is nice to have the option in case the company you are working for wants it.

Not to be left behind, rumour has it that early this year we will see a Zend Core for MySQL as well as a brand new MySQL driver developed specifically for PHP that provides added performance and reliability. When you consider this along with MySQL’s upcoming Falcon storage engine and their extremely useful GUI tools, 2007 may be the year of MySQL as well.

The train has left the station

I have a python book here on my desk that is number 2 or 3 in my reading queue right now, I would really like to learn Ruby (but don’t see it happening anytime soon). I have no doubt that I will find both these languages more pleasant to code with than PHP, but my personal tastes have little to do with what I think will happen in 2007/2008. The PHP train is a rollin’ and my learning or loving another language ain’t gonna stop it.

What do you think? Will 2007/2008 see PHP rise or fall?

No comments:

About Me

Ordinary People that spend much time in the box
Powered By Blogger