I placed this entry under 'programming' but it might as well have been placed under 'rants' really. I've been programming PHP for over six years now. It's still definitely my language of choice because of it's speed, ease of use, ease of deployment and last but not least: because of the huge community with all of it's advantages. However there's one thing that's really bugging me lately: PHP is seriously suffering from what a friend of mine called 'the Apache syndrome'. Apache 2.x has been released a long, long time ago. Yet, tons of servers are still running 1.3.x and they probably will continue to do so for years to come.
While this isn't all that serious for a webserver (as long as it serves it's stuff and the server doesn't break it's fine) I believe the case is different with PHP.
Lately I have the feeling PHP's 'coolness factor' is diminishing faster than Ruby on Rails" gained this status. The main reason for Rails' success is it's advanced development paradigm: Model View Controller. Ruby on Rails forces pure object oriented application design in which the application is strictly divided into three layers: A data layer, a business layer and a presentation layer. Many developers (including PHP developers) are 'discovering' this style of application design through Rails. In short, Ruby on Rails is good news for the web development community. Finally we're moving away from amateurish script hacking into true object oriented application design.
All this stuff however isn't some sort of holy grail introduced by 37Signals. This way of working has existed for much longer. In fact it's being used in most professional software engineering environments. Java, .NET, Python, you name it, the pro's work with MVC and a solid OO architecture. Yet PHP seems to be unable to escape from the script hacking phase in many cases. Skilled PHP developers with solid understanding of OO design who are able to unleash the power of what PHP5 has to offer are extremely hard to find. For some reason, PHP developers seem to be stuck with version 4.x forever and ever. They're missing out on an astonishing amount of new features, better performance, superb new core extensions and last but not least: a mature object model. What a shame that is!
In November 2004 (yes, I kid you not) I already wrote an extensive article on the wonderful new stuff available in PHP5. With version 5.1 there's even more excellent stuff available. Let's walk through some highlights:
- private and protected variables
- private and protected methods
- interfaces
- unified constructors
- abstract classes
- destructors
- exception handling
These were just some features of the new object model. There's more!
- highly improved XML DOM support
- SimpleXML
- highly improved XSLT
- PDO, the new dababase abstraction layer
- SQLite
The list goes on and on and on. Then there's superb frameworks such as Symfony or WASP. There's so much exciting stuff available I haven't even been able to touch half of it. But I did touch the most important thing: PHP 5.x. Going back to version 4 feels like stepping out of a Rolls Royce to continue your journey with an old worn Chevy.
Therefore, PHP developers: Move your ass, port your legacy apps and start reaping the fruits of true web applications with PHP5. It will take some effort if your PHP4 code is of a rather messy nature but if you've been a good boy/girl while developing your PHP4 application it won't be all that hard. After this you'll be able to taste the goodness of PHP5. Do it, today. You won't regret it!
Yes, I know. You can do more or less robust MVC design in PHP4 as well, as long as you're thoroughly disciplined and as long as you 'fake' a lot of stuff you'd use automatically in PHP5. PHP5's object model is simply lightyears ahead of PHP4's one.