Last week, in my article Defending PHP, I laid out my arguments for why I believe PHP is a great language. This spawned many heated comments and counter-posts, including a response by Yukihiro Matsumoto (Matz). Here I'd like to clarify a few points which I think may have been misinterpreted.
Note: Unfortunately, I can't read Japanese, so I am at the mercy of Google's abysmal translation of Matz's article. If I have misinterpreted anything, please let me know.
Defending PHP is not an Attack on Ruby
First, I'd have to say that Defending PHP was in no way meant to be an attack on the Ruby*. There are many, many things I admire about the Ruby programming language which I wish were present in PHP. Here is a short list:
- nil as an object (as opposed to null)
- True closures and proc blocks
- Prototype-based programming
- Ability to override methods on class instances
- Operator overloading
- * Although, admittedly, I did throw a few low-jabs at Java ;)
"Easy to learn" wasn't my idea
In the rebuttal article, Attacking PHP, Jon Candy uses the same format as Defending PHP. In his section "Irrelevant praise", he offers this:
- PHP is great because it allows the new user to pick it up quickly!
- Sure. And if the introductory material available covered good programming style we might not have a problem. In reality, every example PHP script is riddled with SQL Injection vulnerabilities, XSS vulnerabilities, and terrible programming. Most newbs never learn a better way of doing things because this gets them results that look good very quickly.
I'd like to point out that in Defending PHP, "easy to learn" is not a feature I ever meant to put in the PHP "win" column. I think the confusion stems from this excerpt from the "Irrelevant complaints" section of my article:
- PHP allows/promotes poor programming practices
- I call shenanigans on that one. PHP appeals to a broad audience, especially new coders, because it is ubiquitous. It's just as easy to write poor code in any other language (an Interface with exactly one Implementation anyone?)
In that paragraph, I was hoping to express that:
- New coders tend write poor code due to inexperience
- New coders are attracted to PHP because of its ubiquity (easy to get a hold of, lots of examples, tutorials, etc)
- Because PHP attracts inexperienced coders, PHP code in the wild may be disproportionately poor compared with other languages
- PHP does not "promote" poor programming habits (because correlation is not causation)
So in summary, I don't think PHP's appeal to new developers is a pro or con. Newcomers to any trade or technology are bound to make newbie mistakes.
I hope that clears everything up. As usual, I look forward to your feedback!
Got something to say?
Sorry, comments are disabled.
Masaki said ...
Jim R. Wilson said ...
Kristopher Leonard said ...
Ruben Duncan said ...