PHP’s shareability brings all the boys to the yard
A short followup to my PHP post from a couple days back… It spawned some interesting comments that got me thinking some more on the subject. Another post I came across pointed out some other really interesting points about PHP’s architecture.
Both in the comments and on Ian’s blog they note that basically it isn’t the bundling that makes mod_php works well in a shared environment, it’s that it runs very similarly to the CGI model where code is fired up bottom to top every request and goes away completely when it’s over. Which provides a robustness and shared nothing approach that makes it so friendly to shared hosting. PHP squeezes performance out of this by bundling everything in the core language which allows it be written in C and load up really quickly.
My point remains that while it may be hard to make other languages like Perl, Ruby or Python operate well in that environment - there is good reason to consider investigating if it’s worth attempting. Trying to squeeze a reasonable amount of performance in this execution model’s no trivial task to be sure but what’s to be gained?
The benefit of working so well in the shared environment is that the barrier to entry becomes incredibly low. Now, I think a lot of folks actually (whether they know it or not) think that that is a problem - that a lowered barrier to entry somehow makes the language worse by allowing the unwashed masses of “non-developers” to start coding things up. I sure as hell know the stigma associated with that having programmed in Perl since the Perl 4 days - people still like to knock Perl for it.
But in fact it is only good to have more people coding in your language. When you lower the barrier, sure there’s a lot of people who aren’t writing great code - but some percentage of those people are going to progress and become better and better developers. So you eventually wind up with a larger number of developers who are writing really nice code.
Even more than that, all those neophyte developers are also consumers of better written modules and applications. This has more knock-on effects - it means that bugs get found and squashed faster. It means even more encouragement to develop those modules - a virtuous cycle of neophyte developers using modules encouraging more modules and better modules to be developed while at the same time allowing some portion of the neophytes to become better developers and contribute back to the project.
It doesn’t matter that PHP is an ugly language. It matters that there are a lot of really smart people making really nice code in the language that is being widely, widely used. Any language allows you to create good, solid, elegant code - it’s the quality of the developer not the language that matters. And more developers of all skill levels is important for any language. I really believe that a broad and diverse user base is an incredibly powerful thing for a language to have and that it is worthwhile to investigate what it would take to build something that learns from mod_php’s success - narrowing focus of something like mod_perl and seeing what can be seen.







