News for hackers. Stuff that matters.
Re:PHP needs a vision by h2s on Wednesday January 09, 2013 @06:06PM (#5034137)
That closing appeal to deal with the abusiveness of the php.internals list fell a little flat given the opening statement of "shut up". I loved Rasmus' answer to this though.

http://news.php.net/php.internals/64771

    > The vision has been the same for years. A general purpose scripting
    > language with a focus on web development. You are simply saying you want
    > the vision to be more specific than that because everyone has a
    > different view of what web development means. But even if we narrow the
    > vision, it will still be open to a lot interpretation. We try to strike
    > a balance between the different and changing views of web development
    > the same way we strike a balance between appealing to weekend warriors
    > and top-100 trafficed sites. No vision statement is going to answer the
    > question of whether annotations should be in docblocks or in the core
    > language. That's simply not what vision statements do.
    > 
    > -Rasmus
Maintaining clarity of purpose in a project can be difficult sometimes. Kudos to Rasmus for managing to do so in the midst of what looks like it's gearing up to be another php.internals shitstorm.
Re:PHP needs a vision by cies on Wednesday January 09, 2013 @06:26PM (#5034219)
Personally I find nothing much 'general purpose' about PHP. The language has configuration files! That alone prohibits me from doing anything generic with it.

So all that's left for me is 'focus on web development'. And to be honest: I think today it is not even so good at that. We have server side JS (Node), Ruby, Python and Java -- all freely available with huge communities. Does PHP stack up against these today?

I sure see that back in the days, when cgi scripts in Perl were the norm, PHP had huge advantages over its direct competition in open source web dev land.

To me Rasmus merely underlines the lack of vision, or ability to act on one.

Re:PHP needs a vision by cies on Wednesday January 09, 2013 @06:37PM (#5034269)
On a more positive note:

I think the Symfony team actually has the vision: provided it has to be with PHP, let's make a full stack web development framework (like Rails) that does not suck, and create heaps of interesting components/libraries that can be used perfectly on their own in the process!

These guys and girls are showing to what extend PHP can be pushed, they also build a fair share of general purpose libs that the PHP community badly needed (e.g.: composer).

It you are looking for PHP with a vision, line yourself up with Symfony: they seem to have it.

Jokingly: If web development is what PHP is useful for, then Symfony simply needs to be shipped with it :)

Plenty of vision is communicated from their site, and it all makes sense:

http://symfony.com/symfony-at-a-glance

http://symfony.com/elevator-pitches

Re:PHP needs a vision by chrismsnz on Wednesday January 09, 2013 @08:50PM (#5034815)
Completely agree. The people behind Symfony (and other embraced projects such as Composer) are dragging PHP kicking and screaming into the modern age.

The support and tooling they've managed to come up with is great, rivalling some of the more mature languages. Definitely a good "side" to hitch your wagon to.

Re:PHP needs a vision by jaequery on Wednesday January 09, 2013 @09:28PM (#5034980)
have you ever even tried Symfony? i think a lot of the debate is about how people are starting to get fed up with the Java/c#-like direction PHP is heading. symfony is not like rails, no where close to it. not sure exactly where they started taking the wrong turn but it's really going the opposite direction from other languages like node/python/ruby where simplicity is at it's core.
Re:PHP needs a vision by orangethirty on Wednesday January 09, 2013 @11:28PM (#5035406)
PHP is one of the major corporate web languages. That is why its heading down Java street. But that's not a bad thing either. Every language covers a specific need. They can't all be everything to everybody. Sure, there is a lot of horrible PHP code (specially in the online ads industry), but that does not change the fact that the language works for the needs of a given market. I don't get why people want to turn PHP into Ruby/Python. If you want that, then by all means use Ruby/Python. If you have to use PHP at work, then make peace with it, and use a more modern PHP style. If you are going to complain, just do it to your CTO or person in charge of choosing programming languages. Though most don't listen...
Re:PHP needs a vision by fauigerzigerk on Thursday January 10, 2013 @01:52AM (#5035852)
Where "modern PHP style" is defined by the kind of OO frameworkization excesses that the Java community introduced to the world over 10 years ago. It's not a specific need of the enterprise, it's just a historical coincidence.

PHP happened to be the language that websites were written in at a time when the old Java guard came into management positions, bringing with them their failed ideas of what "professional" software design means.

I don't see why you think it is more justified for PHP to become J2EE than Rails/Django. PHP as a language doesn't support one style any better than the other. The only thing that really sets PHP apart from other dynamic languages is that it is a page template engine by default.

So if you absolutely have to ask one of those "why turn PHP into xyz?" questions, why not ask "why turn PHP into anything other than a page template language?".

The answer to all these questions is, because programming languages are indeed languages. People use the languages they know to say the the things they need to say and they use them to experiment with new ideas. That's a good thing.

Re:PHP needs a vision by orangethirty on Thursday January 10, 2013 @02:18AM (#5035913)
I don't see why you think it is more justified for PHP to become J2EE than Rails/Django.

I don't. But like you said (IMO, your comment is spot on), PHP has suffered from the Java mindset. Though I do think that people should not have a language do everything. But thats a problem at the enterprise level, where one size fits all.

Re:PHP needs a vision by tangue on Thursday January 10, 2013 @12:33AM (#5035637)
You nailed it. Symfony == Poor man's Java. Which is ironic because even Java has started to move to move to something more sensible with frameworks like Grails or Play.
Re:PHP needs a vision by objectified on Thursday January 10, 2013 @03:10AM (#5036012)
You may want to take a look at Silex, which is based on Symfony2 components.

http://silex.sensiolabs.org/

Re:PHP needs a vision by tom_m on Thursday January 10, 2013 @12:53AM (#5035698)
Don't forget Lithium. Also a great vision.
Re:PHP needs a vision by cowboyhero on Wednesday January 09, 2013 @08:25PM (#5034733)
> We have server side JS (Node), Ruby, Python and Java --

Hey now. Let's not forget everyone's first love: Perl. :D

It's still quietly running quite a few big sites out there, and is currently enjoying something of a renaissance with frameworks like Mojolicious & Dancer, not to mention the releases of 5.10-5.16.

Re:PHP needs a vision by guelo on Thursday January 10, 2013 @12:07AM (#5035562)
Perl does maintain a strong niche but if the Perl 6 announcement in 2000(!) had been that all focus was shifting to web development Perl would today be king of the heap. It was web development that pushed PHP and Ruby into the spotlight over the last decade, and the 2000ish Java focus on web frameworks also helped keep it popular.
Re:PHP needs a vision by bitcartel on Wednesday January 09, 2013 @09:34PM (#5034999)
I'd say there's life in the old dog yet given that BBC's iPlayer site runs on Catalyst.

On the other hand, Dr Dobbs thinks:

"...Perl continues its long decline. According to Google trends, the number of searches for Perl is 19% of what it was in 2004. Its declining role in open-source communities further cements the perception that it's in an irretrievable tailspin."

http://www.drdobbs.com/jvm/the-rise-and-fall-of-languages-in...

Re:PHP needs a vision by sauravc on Wednesday January 09, 2013 @08:23PM (#5034728)
"I find nothing" is a fairly strong statement. There are plenty of general purpose scripts one can write in PHP. Also config files don't preclude 'general purpose'. For example, run anything in Java and you'll find out there are plenty of defaults running on the JVM that you can override. Yet no one would argue Java isn't a general purpose language. The fact that PHP keeps these defaults in a file is inconsequential.
Re:PHP needs a vision by olleicua on Wednesday January 09, 2013 @08:48PM (#5034806)
How is that a fairly strong statement? Here's a much stronger one: PHP is terrible at being a general purpose language. General purpose language doesn't mean you can do things that aren't web dev in it. General purpose means that it is designed to be useful in any application. You know like Ruby, Python, or Perl. General purpose doesn't mean that those things are possible (because I agree that they are possible in PHP); it means that it is a good tool for any job. PHP isn't just an inferior tool for non web dev projects though, it's also barely better if at all for web dev. LEARN RUBY!
Re:PHP needs a vision by mikegirouard on Thursday January 10, 2013 @12:10AM (#5035570)
I use PHP often for non-web things all the time… I write shell utilities all the time in PHP because it just makes sense: a simple interpreted language, with full access to my app's configuration, database access, dead simple file IO…

The one-liner's are quite nice too… Just today at work I needed to come up with a base64 encoded json string from a data set in an ini file to pass into my Java app via stdin. It was something like:

    php -r 'echo base64_encode(json_encode(parse_ini_file("app.ini")));' | java -classpath Foo.jar com.example.foo.App 
So… yeah. I don't think it's fair to say that "PHP is terrible at being a general purpose language". You just haven't done enough of it yet to appreciate it.
Re:PHP needs a vision by Firehed on Wednesday January 09, 2013 @10:26PM (#5035195)
Why is it a crappy tool for non web stuff? It has an absurdly large set of included tools and having all of that in one place is really handy.

More concretely- what's an easy non-web task that Ruby (as you suggest learning) is great at that PHP can't handle just as easily? Not trolling here, I'm genuinely curious.

Re:PHP needs a vision by eropple on Thursday January 10, 2013 @12:40AM (#5035663)
I find the guy to whom you're replying to be obnoxious, but he's not wrong about it being poor for CLI stuff. Loads of stuff non-obviously behaves differently in a web context versus a CLI context (and while it's documented, you still have to know about it). It doesn't have good stream processing facilities. It, as mentioned, requires a php.ini and requires you to think about that when you're writing scripts in it.

It can be done. It is not something I would recommend under almost any circumstances. (But, then, I wouldn't recommend Ruby for any-any circumstances, so...)

Re:PHP needs a vision by Firehed on Thursday January 10, 2013 @01:48AM (#5035845)
The only real differences from running PHP/CLI that come to mind are:

* PHP_SAPI is defined to 'cli' (as compared to 'fastcgi' or similar)

* $_GET/$_POST are empty, and $_SERVER is missing the HTTP_XXX variables (duh)

* By default, there's no max execution time

I dunno, it works perfectly fine for me. It's certainly easier to read and write than shell, and I genuinely can't think of a time that an ini directive had any effect on what I was doing - unless you count the presence or lack thereof of an extension, but everyone knows that PHP's extension handling is pretty crappy.

I guess it all depends on what you're trying to do. I agree that stream handling is a little rough, although that has little bearing on what I tend to do (YMMV).

At the end of a day, it's a tool, and I have tasks that need to be done. That tool either is or isn't capable of accomplishing those tasks, and based on my own abilities it may or may not be faster than using other tools (contrary to popular opinion, I find Ruby extremely painful to work with, and avoid it at all costs; if it works for other people, good for them!)

This could be a case of "when all you have is a hammer...", but maybe I just happen to have two nails: http://www.codinghorror.com/.a/6a0120a85dcdae970b017742d249d... ;)

/edit: typo

Re:PHP needs a vision by saraid216 on Thursday January 10, 2013 @02:13AM (#5035901)
> More concretely- what's an easy non-web task that Ruby (as you suggest learning) is great at that PHP can't handle just as easily? Not trolling here, I'm genuinely curious.

Is there a decent analog for Nokogiri? I stopped paying attention to PHP 6 years ago so I don't know, but a friend of mine needed to do some webscraping today and learned Ruby and then built his script in 5 minutes.

I checked the IRC timestamps between his "it's done installing" and his "hey, look what it outputted". It was seriously 5 minutes. He then went on to do something a touch more complicated (scraping multiple pages and a trivial analysis/report of the results) and that couldn't have been more than another 30 minutes.

(ETA: I don't know if you'd consider webscraping to be non-web. I guess we could swap it out for a bunch of XML files since that's basically the same task.)

Re:PHP needs a vision by dave1010uk on Thursday January 10, 2013 @02:33AM (#5035946)
PHP has cone a long way in 6 years. Here's a really good PHP web scraper that looks comparable to Nokogiri: https://github.com/fabpot/Goutte
Re:PHP needs a vision by berkes on Thursday January 10, 2013 @07:22AM (#5036549)
Several reasons:

* The bindings for making anything GUI-ish lack. Horribly. I doubt there is one application like an editor written in PHP; that is actually used. * Its long-threads are ... lacking; You cannot write anything deamon-ish in PHP. * Memory management, as Ramus puts it, is not a concern "I just restart Apache". That makes it unusable for anything bigger then a small CLI-tool. * The Cli-libraries are decent, but far from things like Ruby's Thor.

You can write CLI-tools just fine, but "general purpose" is much more then "Managing Web-Content And Some CLI tools".

Re:PHP needs a vision by KorvinSzanto on Thursday January 10, 2013 @10:28AM (#5037348)
Check out Phabricator, it has daemons that are very well managed and cli tools that are fully featured. Arguing that it's unusable for something large is just wrong. The way you manage memory in PHP is the same you way you manage it in any other language; you write /good/ code.
Re:PHP needs a vision by debuggerpk on Thursday January 10, 2013 @08:05AM (#5036642)
exactly right. PHP is like the justin bieber of programming languages.
Re:PHP needs a vision by pserwylo on Wednesday January 09, 2013 @06:51PM (#5034328)
I think that Rasmus and Anthony seem to have two different thoughts on the word "vision". Anthony was very specific in the fact that his concept of a "vision" is about the paradigms PHP supports:

> 1. "PHP Should Strive To Be A Full Featured Object Oriented Language".

> 2. "PHP Should Remain A Procedural Language WIth Some OO Features"

> 3. "PHP Should Be Implementation Neutral, and Support All Paradigms Equally".

Rasmus' response was more general, about the vision for who and what they'd like to enable with the language.

There may be a bit of cross over, but they are two distinctly different views. And for what its worth, I think both are correct. I think PHP should choose to be one of the three things Anthony suggested, and stick to it. This would help in discussions about what features to take on board in new versions. I also think that Rasumus is right in that PHP is a general purpose scripting language with a focus on web development. However this is more about the type of people you will get interested in using and contributing to the language.

EDIT: Grammar

Re:PHP needs a vision by smsm42 on Thursday January 10, 2013 @05:56PM (#5040286)
How using vague terms like "Full Featured Object Oriented Language" is "very specific"? Every OO language out there has different set of features, and the only thing this definition is useful is for bashing opponents over the head with "ah, you don't want this feature? But language X has it, and our vision says we have to be full-featured, so we need to add it no matter what!" Java has checked exceptions? Then PHP should have checked exceptions, otherwise it's not full-featured. And so on. I don't see this as specific vision, but rather as a cart-blanche to abandon reason and consideration. I'm not sure if "specific vision" is possible but using vague undefined terms like "full featured" does not make it specific and it is impossible to reasonably "stick" to it as nobody really knows what it means.