Why Is PHP Better Than Python?
Posted in Django
on September 14th, 2009 by
Stephen DeGrace
Well, I don't really think PHP is better. But...
I've been making web pages and web applications for a lot of years, most of them probably very bad lol. My first introduction to web programming was through PHP. My previous programming experience had been in C++. I knew that for what I wanted to do on my web pages there was no substitute for server side programming but I couldn't see any way to go about it, not having access to the server. Then I discovered PHP and it was the answer to all my wishes - ordinary web pages could contain the server-side scripting and simply be uploaded like static HTML.
PHP is really powerful and I think a great language to start programming in simply because it has a great library, some of the best docs out there, and is really, really flexible and forgiving without being a slithering nightmare like the language which is plainly a large part of its inspiration, Perl. I wrote a home-rolled CMS in PHP as well as a little multi-user app for storing and organizing your links and sending other users messages that I used at a call centre job I had at the time.
At some point I started looking for a scripting language for my non-web projects and spent some time on Perl. I got turned off in because it's just too slippery. TIMTOWTDI means it can be hard to understand your own code when you come back to it later, let alone someone else's. I looked into a few alternatives, and after mulling over Ruby for a whileI finally settled on Python, liking its clean philosophy and powerful features. I love things like being able to modify classes on the fly, and list comprehensions.
I only recently got into doing my web work in Python and for my new home page chose Django. I'm completely satisfied in terms of my own experience and what I wanted to get out of it.
But I mean, look at the actual open source apps out there for PHP, versus what the Python or even Ruby and their vaunted Rails has to offer. I think for an amateur I did a pretty decent job with this web site - it supports multiple blogs, pages, a highly flexible tree-based menu structure, and photo galleries, and has a nice JavaScript editor built in with fairly easy and very flexible syntax highlighting (I like it, anyway). My app is awesome for me because it is exactly the way I want it and I know exactly how it works, but if you were a random blogger and were comparing the features of my blog and the features of WordPress, I think you'd pick WordPress every time. It's just much more polished and much easier, the kind of thing that only comes from having many people investing large amounts of work on it.
When I make web pages for other people, as I did this weekend for a little game we're playing at work, I always pull a PHP app like WordPress, Joomla or phpBB off the shelf. Poo-poo them all you like, these are great, powerful, user-friendly applications and the Python world has nothing remotely like them. Anything we do have if I am thinking of a choice between that and one of these PHP apps for some people who are really, really hopeless with computers, I will always do the responsible thing and go for the PHP app.
If I was working on a project which was a very specific application that would have its own dedicated development team and I had a choice I would never choose PHP. Once you get used to it, I find PHP is aggravating, and the page-request-to-execute-files interaction mode you have to use with it, maybe hidden by mod_rewrite but still, is an awful way to run a web app.
PHP has the advantage that it is just so ubiquitously supported and just so bloody easy. Hideous lack of namespaces (until version 5, and as for version 5 I have just one comment on the namespaces - yuck) and spew of grossly inconsistently named and called functions notwithstanding, the library is comprehensive and the great docs make up for a lot of the weird function names and argument orders. Its page request style of interaction which conceptually tries to draw you into writing spaghetti code is also super easy to set up a server to support. And of course it has momentum.
I don't think it is enough to dismiss the much better end-user-ready applications and much broader support available in the PHP world as momentum, though. They're doing some things right. I think WSGI and projects like django-cms are steps in the right direction for Python and Django, but I think a lot more work in these areas is needed for Python as a web application development platform to fulfill its potential to provide superior applications to the public and a superior developer experience therefore to those who have to work with them.
PHP's competitors in the world of web programming need some real killer end-user apps out there, not just killer development frameworks, or they will never challenge the ubiquity of support PHP enjoys and PHP will remain king.
Comments:
There are 0 comments on this item. Be the first to comment.
Post a Comment
* Required field, your email will not be posted.