Look at this incredible thing Ian Baker created. Look at it!
What you're seeing is not Photoshopped. This is an actual photo of a real world, honest to God double-clawed hammer. Such a thing exists. Isn't that amazing? And also, perhaps, a little disturbing?
That wondrous hammer is a delightful real-world acknowledgement of the epic blog entry PHP: A Fractal of Bad Design.
I can’t even say what’s wrong with PHP, because – okay. Imagine you have uh, a toolbox. A set of tools. Looks okay, standard stuff in there.
You pull out a screwdriver, and you see it’s one of those weird tri-headed things. Okay, well, that’s not very useful to you, but you guess it comes in handy sometimes.
You pull out the hammer, but to your dismay, it has the claw part on both sides. Still serviceable though, I mean, you can hit nails with the middle of the head holding it sideways.
You pull out the pliers, but they don’t have those serrated surfaces; it’s flat and smooth. That’s less useful, but it still turns bolts well enough, so whatever.
And on you go. Everything in the box is kind of weird and quirky, but maybe not enough to make it completely worthless. And there’s no clear problem with the set as a whole; it still has all the tools.
Now imagine you meet millions of carpenters using this toolbox who tell you “well hey what’s the problem with these tools? They’re all I’ve ever used and they work fine!” And the carpenters show you the houses they’ve built, where every room is a pentagon and the roof is upside-down. And you knock on the front door and it just collapses inwards and they all yell at you for breaking their door.
That’s what’s wrong with PHP.
Remember the immediate visceral reaction you had to the double-clawed hammer? That's exactly the reaction most sane programmers have to their first encounter with the web programming language PHP.
This has been going on for years. I published my contribution to the genre in 2008 with PHP Sucks, But It Doesn't Matter.
I'm no language elitist, but language design is hard. There's a reason that some of the most famous computer scientists in the world are also language designers. And it's a crying shame none of them ever had the opportunity to work on PHP. From what I've seen of it, PHP isn't so much a language as a random collection of arbitrary stuff, a virtual explosion at the keyword and function factory. Bear in mind this is coming from a guy who was weaned on BASIC, a language that gets about as much respect as Rodney Dangerfield. So I am not unfamiliar with the genre.
Except now it's 2012, and fellow programmers are still writing long screeds bemoaning the awfulness of PHP!
What's depressing is not that PHP is horribly designed. Does anyone even dispute that PHP is the worst designed mainstream "language" to blight our craft in decades? What's truly depressing is that so little has changed. Just one year ago, legendary hacker Jamie Zawinski had this to say about PHP:
I used to think that PHP was the biggest, stinkiest dump that the computer industry had taken on my life in a decade. Then I started needing to do things that could only be accomplished in AppleScript.
Is PHP so broken as to be unworkable? No. Clearly not. The great crime of PHP is its utter banality. Its continued propularity is living proof that quality is irrelevant; cheap and popular and everywhere always wins. PHP is the Nickelback of programming languages. And, yes, out of frustration with the status quo I may have recently referred to Rasmus Lerdorf, the father of PHP, as history's greatest monster. I've told myself a million times to stop exaggerating.
The hammer metaphor is apt, because at its core, this is about proper tooling. As presciently noted by Alex Papadimoulis:
What we ought to be talking about is not how terrible PHP is – although its continued terribleness is a particularly damning indictment – but how we programmers can culturally displace a deeply flawed tool with a better one. How do we encourage new programmers to avoid picking up the double clawed hammer in favor of, well, a regular hammer?A client has asked me to build and install a custom shelving system. I'm at the point where I need to nail it, but I'm not sure what to use to pound the nails in. Should I use an old shoe or a glass bottle?
How would you answer the question?
- It depends. If you are looking to pound a small (20lb) nail in something like drywall, you'll find it much easier to use the bottle, especially if the shoe is dirty. However, if you are trying to drive a heavy nail into some wood, go with the shoe: the bottle will shatter in your hand.
- There is something fundamentally wrong with the way you are building; you need to use real tools. Yes, it may involve a trip to the toolbox (or even to the hardware store), but doing it the right way is going to save a lot of time, money, and aggravation through the lifecycle of your product. You need to stop building things for money until you understand the basics of construction.
This is not an abstract, academic concern to me. I'm starting a new open source web project with the goal of making the code as freely and easily runnable to the world as possible. Despite the serious problems with PHP, I was forced to consider it. If you want to produce free-as-in-whatever code that runs on virtually every server in the world with zero friction or configuration hassles, PHP is damn near your only option. If that doesn't scare you, then check your pulse, because you might be dead.
Therefore, I'd like to submit a humble suggestion to my fellow programmers. The next time you feel the urge to write Yet Another Epic Critique of PHP, consider that:
We've got a long way to go. One of the explicit goals of my next project is to do whatever we can to buff up a … particular … open source language ecosystem such that it can truly compete with PHP in ease of installation and deployment.
From my perspective, the point of all these "PHP is broken" rants is not just to complain, but to help educate and potentially warn off new coders starting new codebases. Some fine, even historic work has been done in PHP despite the madness, unquestionably. But now we need to work together to fix what is broken. The best way to fix the PHP problem at this point is to make the alternatives so outstanding that the choice of the better hammer becomes obvious.
That's the PHP Singularity I'm hoping for. I'm trying like hell to do my part to make it happen. How about you?
| [advertisement] How are you showing off your awesome? Create a Stack Overflow Careers profile and show off all of your hard work from Stack Overflow, Github, and virtually every other coding site. Who knows, you might even get recruited for a great new position! |
This article "inspired" the first post in my blog. Here are my 5 points why PHP is not easy and straightforward as it may seem:
http://yatb.giacomodrago.com/en/post/1/php-is-not-easy-as-it-may-seem.html
Share your thoughts! :)
Giacomo Drago on November 13, 2012 7:58 AMI am amazed at the negative responses. I know PHP isn't perfect, but why are some of you morons using PHP for projects, making a living of it and then hating on it? PHP websites are easy to deploy, runs on almost any web server, easy to understand. If you cannot code a good web application blame yourself not the language, I've seen good and bad web applications in PHP. The only thing I see in this blog post is that the author is trying to get some attention.
" I'm starting a new open source web project with the goal of making the code as freely and easily runnable to the world as possible. Despite the serious problems with PHP, I was forced to consider it. "
Yeah typical Internet tough guy.
Nw Trailers on November 14, 2012 3:48 AM"Despite the serious problems with PHP, I was forced to consider it."
So, 5 months later, what did you go with?
Mark Neumann on November 16, 2012 11:02 AMThis reminds me a lot of Stockholm Syndrome. Surf MoviesPHP causes pain so consistently that people consider
Noman-memon1 on November 27, 2012 10:34 AMjust rant...
Brunoric on November 29, 2012 9:18 AMYou pull out the pliers, but they don’t have those serrated surfaces; it’s flat and smooth. That’s less useful, but it still turns bolts well enough, so whatever. Páginas Amarillas
Php is AWESOME. What other languages have http methods already built into it? Sure, you’re not going to build a state of the art search engine with it, but what other languages out there can you use by itself– without installing some ridiculous framework– and still produce a decent app from it? Of course, you can choose to use a framework if you want to... that's half the fun of using the language. With PHP you choose your own workflow, your own destiny.
Those who bash PHP don’t understand it. It’s not really a language. It is a template language- and it has only been a good 10 years it has been considered to be a viable solution for building sites with it, only about 5 years a secure solution to interacting with database layers. PHP is still young. Those who spend years working with Java and C bash PHP for its OOP facility and security flaws. It is 2012, and PHP is still scripting language with a few comp sci principles adopted to it. So what? That’s what it has always been.
I’m sick of people bashing PHP for what it can’t do. Instead, embrace it for what it CAN do: Community sites, blogs, wikis, simple stuff. Look around. Over half the startups out there choose PHP. Are we a glutton for punishment? Maybe. But we also know that you don’t put your life’s work , or stake your thesis in comp sci on PHP. Working with PHP is about simple design patterns and using that to bang out simple and highly scalable solutions- albeit a little ugly.
So go ahead- keep bashing PHP and use a "real language" for your next project. Build your beautiful classes, interfaces, and singletons in the privacy of your own windowless basement- because that's about as far as you're going to go with it for your first 6 months of development. In the meantime, I'll keep building my horrible spaghetti coded community sites, hosted on my 3 dollar a month shared servers, and laugh all the way to the bank.
F Haegele on December 26, 2012 1:04 PMno more desktops, no more PC's. They want tablets that they can bring with them, that are completely wireless with a touch-screen and a nice bag to carry it in. So yeah, I can see how the PC is disappearing, becoming less and less interesting for the mundanes while the experts still need them. buy facebook fans
Thanks for this. I picked up JavaScript SQL and ASIII so easily and PHP just feels like total chaos. I thought I was just an idiot graphic designer but it feels good to have someone who knows what they're talking about confirm my suspicions.
proxette on January 5, 2013 12:52 PMThe biggest problem of these rants is that they come from people stuck in the old days of PHP. They either don't care or they don't want to admit that PHP actually evolves at a very fast pace, both at the language level but also at the community level. In fact, it evolves much faster than any other language or web platform. It has not always been the case, but the last 5 years have been an amazing journey for PHP.
Nick_Johnsn on March 11, 2013 12:54 AMRIGHT! Blame it on the tools NOT the one using the tools.
Guess what Jeff,
a good programmer is a good programmer (regardless of tools).
I don't have much exp. with PHP. But let me tell you one think about it:
every time I wanted something changed in my PHP wordpress blog, it never took me more than 5min to do it! with almost 0 knowledge of the language!
Cant say the same for ...... pyhon ,, ruby ,,,, C#
Ppetrovdotnet on May 16, 2013 4:44 AMI don't think I've ever read an article so off base, or one that generated such a visceral response of disgust. PHP is a very usable programming tool, and I've built thousands of apps on it over the years (from the very beginning). Use what you want, but leave my tools alone! Keep your bigotry to yourself.
Steve Spence on May 16, 2013 7:42 AMInoryy: if your take-away from Munroe's and others comments about PHP is that they didn't explain why PHP is so bad then you didn't read those articles. Munroe is very explicate with exact cases why PHP is a Bad Language. I could easily use your refutation tactic and say that just because everyone uses it doesn't mean its a good language (which actually in my opinion is a completely valid argument). PHP is a bad language and 20 years experience using C/C++/Java/Perl/Shell/.NET will make it patently obvious to you. I'd still rather use perl before picking up the old double-clawed nightmare that is PHP.
Xeyedmary on May 16, 2013 9:05 AMThis is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
|
|
Traffic Stats |
Posted by: |