September 11, 2004

PHP overtaking Perl, and why it doesn't matter

Joe Johnston talks about PHP overtaking mod_perl in popularity:

Now, it's not that mod_perl suck (it doesn't) or that it's not useful in some situations (it is), is just that MOST PEOPLE ARE SIMPLY DOING CGI CRAP.

...and this is exactly why PHP's popularity shouldn't concern anyone developing in a real language. So what if there are three billion kids on the planet hacking PHP? For the largest part, PHP's userbase is operating on a level where you shouldn't consider it a boon if this sort of people suddenly decided to turn over to Camp Camel.

PHP was created for one reason: To provide easy access to quick CGI hacks for amateur programmers (certainly there are people developing serious applications using PHP as well, but these aren't responsible for PHP's massive rate of growth). PHP's crudeness is actually by design in order to lower the barrier of entry for people who struggle with other things than programming in their day job.

Don't compete with PHP for these kinds of people. They don't want nor need something more sophisticated.

Comments

So real programming languages should be hard to learn?

They should be obtuse and require far greater knowledge than is required? Should they also include a large degree of undocumented quirks?

If that description were applied to a piece of software we'd say it was crap and user *un-friendly*.

Computers are just tools. Languages are the interface that we use in order to instruct them to do what we want them to do.

You really should not be thinking along the lines of elitism when it comes to writing code. After all, you were a noob once remember.

Posted by duncan (#)

duncan, different people demand different things from their language. My 'elitism' is recognizing this as a fact.

For the average web grunt, PHP is just the thing they need. PHP's lack of namespaces, modularity, database abstraction, etc. doesn't concern them, even helps them to get things done with a minimum of learning. For someone developing larger applications however, every single one of these issues are an immediate show stopper.

There is NO WAY to cater to both camps. Say you took the three thousand and something functions in the PHP core and divided them into modules, let alone provide object oriented interfaces to them, most of PHP's userbase would be up in arms. And from their point of view, rightfully so.

It is just as wrong to water down the (for 'real' developers) right design choices of a language to make it more newbie-friendly as it is to make PHP more complex than it is today. Different people, different requirements.

Posted by Henning [TypeKey Profile Page] (#)

Yes, I'm sure all the 'amateur' PHP 'kids' are pleased to be writing code in a language whose 'crudeness' is there to benefit them and make sure they get their projects done on time.

Python's simplicity isn't seen as crude, Perl's OO system requires you to code around it - wouldn't you call that crude?

It's interesting to see how languages adapt to this kind of rise in popularity of other languages though.

Python produced Bean Shell out of Java and you're suggesting that Perl should react to PHP by ignoring it.

Posted by duncan (#)

Perl's baroque OO system sucks a water melon through a garden hose and could only benefit by copying from languages like Ruby and Python. The design of both, by the way, I think is way superior to that of Perl.

I don't however see a single thing that Perl, or any other language could possibly learn from PHP, but I'd love to hear suggestions.

Posted by Henning [TypeKey Profile Page] (#)

> There is NO WAY to cater to both camps.

Sorry to have to be the one to inform you, but it appears that PHP has done exactly that. The only people it doesn't cater to are those who hate to admit it - those stuck in the void between the beginners and the experts - who want their language to be the best in order to not have to learn a new one. It's sad to see that some of the Perl community falls into this category, since I had believed it to be mostly Java developers.

I equally prefer PHP and mod_perl, and Yahoo chose PHP over mod_perl. A company that big with that much money doesn't choose a language because it's easier for inexperienced developers.

Posted by japh (#)

Not a *single* thing? Really?

Posted by duncan (#)

duncan: Sans the new Javaish object and exception handling in PHP 5, yes, I think so. But I'm not married to a language, so by all means: Please convert me.

Posted by Henning [TypeKey Profile Page] (#)

I didn't intend to (I prefer Python) - I'm just surprised at any developer who doesn't think they can learn from the popularity of another language.

Posted by duncan (#)

I've been a dedicated Perl hacker for about ten years. Each time I've tried to learn PHP, I've ended up doing the equivalent of throwing it across the room after ten minutes. Perl may suck in certain areas, but PHP sucks a whole lot worse.

However, this is not the point. The point is that I am in an ever-shrinking minority, and I can see why. PHP is grabbing a far larger chunk of those starting web development than Perl. PHP is better for getting something running quickly. PHP is also, in many ways, a better option for those writing large, complex web applications. (Take a look at the massive number of PHP-based CMSes, community systems and database tools that have appeared in the past two years, and compare against the number that have been written in Perl and released in the same time span.) Sure, it's a pig to write in, but it's better in most of the ways that seem to count - it's much easier to get stuff running from the start, whether you're writing an app or simply installing one (and I can't stress enough just how much the latter consideration matters).

The Perl community should be far more worried than it is, and *should* be competing with PHP. The webapp development domain is one that fits so snugly with Perl's target areas that it's a *major* problem if we can't even do that better than a language as poor as PHP4. And the reasons we're not doing well are almost nothing to do with language design - they're almost all to do with operational issues, such as getting mod_perl running happily, getting apps running happily if you're not root, module dependencies etc. PHP makes most of these issues a breeze. Perl's mission statement is "Make easy things easy and hard things possible". In the case of webapp development, Perl is no longer living up to it.

The most frustrating thing about this is that the Perl community has solved far harder problems than this one, but it doesn't seem to want to acknowledge it. As a result, it may end up with a considerably smaller member base than it currently has, and everything Perl-related will suffer as a result.

Yes, we should care.

Posted by Yoz [TypeKey Profile Page] (#)

As an intermediate Perl web developer I tear my hair out at the Perl community's apathy towards PHP's onslaught in the web development world. Don't you realise that it's Perl's mindshare that PHP is sapping? Who do you think is going to be using Perl when all the UNIX sysadmins have grown too old to bang away at a keyboard all day?

Perl6's response - more complexity and obscurity. I don't hear anyone addressing the problems deploying Perl in web hosting environments. We don't need a better mod_perl. We need a replacement for it that doesn't give sysadmins nightmares if they throw it onto a shared server.

To give you an idea about how bad the PHP replacing Perl phenomenon has already become, I recently contacted Paul Dubois, first congratulating him on his excellent "Perl and MySQL for the Web", then asking him why, 3 years later, it is still the only book to counter the truckload of PHP/MySQL books. He then confessed that the book sold very badly. Can you believe it? The Perl community has 1 book on Perl/MySQL and no-one wants it.

I contacted Alison Randall at O'Reilly begging her to find someone to write a Perl/MySQL web development tome or, even better, a Perl/PostgreSQL tome. At least something aimed at web development with Perl and a database. Her reply? Ther isn't a market for it.

What does this tell us about the Perl community? My prediction is that Perl's user base will dwindle back to the bunch of UNIX sysadmins who gave birth to it .... and that's from someone who's first language was Perl and who considers it far superior to anything Rasmus Lerdorf of Zeev Suraski has produced.


Posted by Anon (#)

it's been a long time since i did my web development in perl, so forgive me if my comments don't acknowledge recent improvements but here's my quick attempt at an advantage of php over perl: associative arrays (hashes) and numeric arrays are syntactically the same.

php uses $foo[1] and $foo['bar']
perl uses $foo[1] and $foo{'bar'}

php's syntax is simpler and does exactly the same thing. why doesn't perl adopt this?

Posted by scott reynen (#)

Scott: It seems rather inefficient to use hashes for numerically indexed arrays. If I recall correctly, both arrays and hashes are initialized through "array()" in PHP.

Ruby has the unified indexer syntax from PHP, but has two different methods for initializing a collection depending on whether you'd like an array or a hash.

Posted by Henning [TypeKey Profile Page] (#)