Creator of PHP talks to Digg about performance and security
about.digg.com
about.digg.com
"PHP is just a damn tool. It's just a hammer; it's boring. It's not that interesting. I'm not that interested in it. But I need a working tool to solve problems. I'm really, really interested in problems. The tool itself; if it works great. If it's broken I fix it. But I don't spend my entire life fixing it. PHP is damn ugly. It'll always be ugly because we're not going to spend the time to sit and make it pretty. We're spending our time building actual solutions and fixing problems. And the tool works. You can build really, really fast things with PHP. And yes, it's not pretty. If you're a CS major or if all sort of for the purity of coding; PHP is not for you. But then you're not probably not interested in building things for end users."
Also, people who usually have that sentiment are not the same people who have to maintain the code. They're usually long gone by then. I have personally suffered many sleepless nights having to maintain projects like that.
I think it's healthy to avoid extremes. Neither a "whatever works" nor a "write everything in lisp because it's beautiful" sentiment. It's up to the good programmer to decide when to be a pragmatist and when to be a purist.
I'm very productive in PHP; that doesn't change the fact that I discovered I could be more productive in other languages that didn't actively frustrate my development progress due to being well-designed.
Programma hatas gon hate.
I've built some non-trivial application in a number of environments just to see what the grass is like on the other side of the street. Each and every solution I tried has its own warts and requires you to work around a new set of issues.
PHP is a 'bad' programming language, it smells of band-aids all over. But for all the elegance and brevity of some of the other contenders there isn't a single one that is better on all fronts. So far. Still looking, still trying new stuff. If I find something that makes me really happy I'll feel so much better because the P*/Javascript/CSS/HTML/SQL hodge-podge that we call web applications feels like the absolute wrong way to develop software to me.
We're doing something terribly wrong.
The only downside is that it requires Jetty (or Tomcat) to be deployed, which means you can't use it on a shared host.
Everyone just likes to hate on it because it's not "proper" enough for the academics and doesn't make enough assumptions (ala RoR) for many of the practicalists (I know I'm making up a word).
Perl, on the other hand, was designed with "academic" abstraction mechanisms that can be hooked to change the language. For years, this was a problem -- Perl 5's object system was more like an object system object system. Everyone built their own object system for every application, and then used that. This made a mess, and annoyed everyone, because everyone was doing OO in their own slightly-wrong way. Yuck.
Then someone decided, "hey, let's use this object system object system to write a real object system!", and Moose was born. Now most new Perl 5 apps all use the same object system, and everything works much better. OO modules compose. Objects can be shared. It's possible to write object databases that actually work. (Just look at the MooseX:: namespace on search.cpan. All of these modules fundamentally change how "object oriented programming" works for a particular class or group of classes, but they all compose together cleanly and don't have effect outside of a limited scope. Beautiful! And it makes writing reusable code easy!)
No changes to Perl were ever needed for this, and yet the object system is probably the most flexible and feature-rich of any major programming language.
If PHP had the ability to be changed by PHP programmers, then the massive community would have cleanly fixed all the problems already. The Perl community did it. The Ruby community did it. Even the Java community sort of did it. But since the attitude is that PHP is just a hack on a hack, and web apps should just be hacks, PHP remains a hack on a hack that's too difficult to use for complex projects.
PHP's greatest strength is also its greatest weakness: it's very easy to pick up and start running code. Have you read the huge number of broken tutorials that tell newbie users how cool, for example, variable variables are? Can you imagine the new levels of abuse such a system would introduce? ;)
Actually yes, it's called Rails.
But anyway, a system that can't be broken is also one that can't be fixed. PHP programmers switching to Rails did some weird stuff, but without that ability to do weird stuff, Rails wouldn't have even been possible.
I want to have beautiful and powerful tools. The code you write using an elegant language might as well be ugly. This shouldn't stop you from enjoying the process and demanding the best tools to do an already difficult job.
He admits that PHP ain't pretty, but argues that it does the job and that's good enough. Yes, yes it is good enough. However, he also claims that its the way it should be if you are "interested in building software for the end user." No, it really shouldn't, and thankfully we have practical languages and successful projects that prove it.
http://www.activestate.com/blog/2010/07/growth-dynamic-langu...
which shows PHP is used more than any other dynamic language and it is growing faster than Ruby, but not as fast as Python and Javascript.
As for growth rate, I question any study on "programming language usage" because it's very hard to define what that even means. Still, I'm not surprised by their findings. We've all seen the explosion of Python—both with hobbyists and huge corporations. As for PHP still increasing, that could be attributed simply to the persistent increase in web usage in general. It doesn't necessarily mean PHP is "beating" Ruby.
1) it is easy to get startet
2) it is supported by just about every single host ever
So if I'm not willing to use a tool that will create a mess that is expensive to maintain then I probably don't care about end users? Fallacy detected.
That doesn't mean that creating maintainable PHP software can't be done - it's actually been done many times. While I agree that languages can make a big difference in maintainability, please stop blaming a programming language for your own mistakes.
Rasmus is eminently practical. Mucho respect to the man.
He doesn't seem that interested in fixing those problems, either.
"I never taken any classes in computer science. I should have taken classes in computer science".
So it was never designed to be a state of the art language. Just a tool to get things done. From 1997 to 2001 I really enjoyed solving problems in PHP. But things have changed. I have learned more and now certainly prefer using Ruby.
You can pretty much boil his talk down to use a profiler and make sure you run as little lines of code as possible. (AKA: Extra indirection always adds extra cost which is why generic web dev frameworks are always slow)
The HipHop part of his talk isn't really useful because extremely few sites are resource constrained enough at the web server level for it to make sense to complicate your deployments that massively.
The performance stuff was pretty boring. 30 minutes of talking to go from 9 to 34 reqs/s. My VPS provider can increase my resources by an order of magnitude in 1 minute.
If you take a look at any community of designers who consider themselves 'developers', its scary - most of them build on WordPress as a platform. Clearly this is somewhat like putting up a tent on the Deepwater Horizon drilling platform. I can't believe how terrible the innards of wordpress are. That said, the outtards work pretty well, somehow.
Most of Rasmus's talk is the same as it was for years in regards to optimization. If you've seen one of his older presentations take a look at the slides directly (http://talks.php.net/show/digg/1) rather than watching the video.
If I am not mistaken there are a couple of projects already working on that.
Also, it's supposedly REALLY difficult to build.
I was thinking more like PHC but more evolved.
I'm interested in how you'd like phc to be more evolved. I've had lots of ideas (I'm the author) but I'm curious what others would like. Thanks!
PHP lacks any kind of design, it was just an rapidly evolved toolchan. ^_^
i suppose thats my point. languages are just tools. some languages are hammers, where you can accidentally hit your thumb. some languages are like an automatic electric hammer where its all safe, but its heavy and you have to keep it plugged into the wall.