PHP's brighter future? On the "PHP the Right Way" project
blog.phpfog.com
blog.phpfog.com
I'm just going to say that's it's a bit amusing that of the things he lists as "revelations" python has had since:
1. when dinosaurs roamed the earth (lambda)
2. 2003 (wsgi)
3. years ago (pip/easy_install)
4. ages (db-api)
More cogently: If PHP is where python was in 2007, why wouldn't I want to use the python of 2012?
Also, I can find no reference to PHP having anonymous functions/lambdas prior to 5.3, which is the version number given in both the linked article and PHP docs.
The key thing with a lambda in python is that it is defined at the usage site.
so you can do:
filter(lambda x: x > 42, mylist)
Whereas in php that would be: $mylambda = create_function('$x','return $x > 42;');
filter($mylambda, $mylist);
Yes, the usage strings as code adds yet another level of WTF to this example.Note that php.net/create_function even points you to their page on actual anonymous functions, which they erroneously claim are the same as closures.
I also find the "there's tons of spaghetti code in other languages" argument tiresome. That's true, but well-designed languages tend to help keep people off that path - or at least do a better job of doing so. PHP is not one of those languages, hence the need for a "PHP the Right Way".
As asserted in the post, PHP is indeed used on a ton of websites. Most of these websites were written when PHP was the best tool for the job. But languages evolve. Other languages have learned the lessons of PHP and improved upon it.
PHP has done a fine job of "modernizing" itself lately, but it's still stuck with a lower quality overall design than some of the alternatives, and those alternatives have kept moving forward at the same time too. It reminds me a lot of IE's "look, we've implemented that thing that the good browsers had 3 years ago" announcements. It's great that PHP is not standing still, and that continued improvement must be awesome for existing projects that are built on PHP.
But for me, starting new projects in 2012, there's zero compelling case for using PHP, just as there are many old languages that would have been "the" choice once upon a time, but are now replaced by better things.
I thought we agreed that different solutions required different tools?
It's 2012 and all of our new apps our driven by PHP+Symfony2 with AngularJS on top. This combination has been huge for us (my company, I mean).
Maybe what should be answering is what "things" are better compared to PHP development with equal expertise. Like, what will RoR do for me that my existing setup won't? Why swap Symfony2 for ExpressJS and a multitude of NPM packages?
I'm alays eager, like most of the HN community, to be sold on the next great thing that makes my life easier, code cleaner, and site faster. But aside from language design, I haven't seen any apples-to-apples comparisons on the applications of these "better things."