Received this yesterday:
So I’m thinking of starting a new web project and was wondering if I could seek your advice. My tendency is to use PHP since that’s what I know and have used most in the past. Though, after talking to a lot of folks (namely Googlers…go figure), I’ve been encouraged to instead choose Python.
Seeing as you’re my favorite PHP Terrorist I was wondering if you have any specific thoughts on the subject.
I still need to write another article on Python, but the short answer is I think if it’s web, PHP is probably the better choice.
“PHP is the shortest point between two distances on the web.”
—Me, tongue-tied at a talk
However there are some mitigating factors to consider:
- If your budget is very tight, then you can use Python and host it on Google App Engine. Yes, there are other solutions like Windows Azure and Ning, but I think that above shared hosting and short of slicehost, Google is the best option.
- If you only want to use/learn/maintain one language throughout the entire setup, then Python is a better choice. PHP can’t do high concurrency and it’s not very versatile by itself.
PHP’s advantages are its ubiquity (host anywhere), relatively low skill requirements (easy to pick up), and it’s ability to work with other software packages and languages with ease (simple and sucky). PHP is an easy second language to pick up because its similarity to scripting, C, Perl, etc., great documentation, and high availability. On the other hand, hiring good PHP developers who can design a clean architecture that isn’t overbuilt or spaghetti is hard.
Python’s advantages are its collaboration for larger projects (clean design and readability), and being probably the best general scripting language on the market (versatility). Python is also a much easier language to learn to program for the first time. Learning Python for the web, pretty much means learning two things though: Python and a framework like Django.
As for Google, I’m not surprised. Google is very pro-python when choosing a scripting language, sometimes to the point of irrationality—YouTube for instance. In fact, the knee jerk reaction of almost any Googler is “use Python” in response to any programming question where a scripting language is involved. The reality is there is no best—just a series of “good enough” choices.
Look at the top 100 websites on the internet: about 40% of them are written in PHP and 0% of them are written in Rails…But to me, there is an alternate conclusion, since 60% of sites out there don’t use PHP: “The web problem ain’t that hard.”
PHP may be the best web language out there. But it certainly isn’t the only one. It’s one approach, one that stresses configuration over convention, stupidity over smarts, practicality over elegance.