Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

http://hammerprinciple.com/therighttool/items/php

Jesus christ guys. It were probably others than visitors from HN (most here are a little more thoughtful and less trolling), but if there is nothing but negativism on the PHP page (I can't find a single positive point) then why in the world are we all using it? Why does almost everyone know the language? Why is it one of the biggest languages on the planet?

I don't trust this site anymore just because of the first item I happen to look at. PHP may or may not be a horrible language, but certainly it has some good uses and advantages to other languages, or it would never have become popular at all. Perhaps it's just because PHP is so easy and that's the only reason. I'm not saying it is, but it might be. But then at least that should have been written on the page.



My take on why PHP is popular: web programming back in the late 90ies was not easy, and the tools available looked something like this:

* Perl CGI's, and, later on, mod_perl. Worked pretty well, and Perl is a serious language, but things got big and clunky, especially with mod_perl. CGI's are kind of slow.

* Various proprietary Tcl solutions. These were very cutting edge in many ways, but were open sourced far too late.

* Java towards the very end of the decade. Then, as now, it was a fairly heavy-duty solution; not suitable for, say, adding a dynamic time or something like that to an otherwise static page.

* PHP. Fairly easy to install compared to the alternatives, and reasonably easy to get started with. You did not need to understand classes, OO, and how to compile things just to get a dynamic web page up and running.

In short, PHP "scales down" in terms of programmer effort to get started, giving people at the margin the ability to do something they otherwise would not have. Granted, that something might have been quite ugly, but at least you could get started.


Particularly ironic is PHP ranking high for ``This language is likely to be a passing fad''. Given its 17 years of history and recent the recent progress with versions 5.3 and newer... whoever voted on this position either wasn't aware of PHP's actual situation and outlook, or was just being thinking wishful.

-- EDIT --

> Why does almost everyone know the language?

If anything, it is that almost everyone can dabble in PHP and ^C^V some code. IMHO real knowledge of PHP and its ecosystem seem to be quite rare -- judging by reading some published code, which was as generic and un-PHP as possible, and by comments attached to the official docs.


Given its 17 years of history and recent the recent progress with versions 5.3 and newer... whoever voted on this position either wasn't aware of PHP's actual situation and outlook, or was just being thinking wishful.

I don't know, I think it's a good prediction. Look at this chart for example (yeah, I know... tiobe isn't necessarily an accurate indicator but still):

http://www.tiobe.com/index.php/paperinfo/tpci/PHP.html

In the 2000s, PHP was everywhere. But recently, Rails, Django, Node.js etc. seem to be much more prominent. Maybe thinking of PHP as a fad is slightly... optimistic, but I wouldn't call it "wishful thinking" as if PHP was here to stay forever as one of the most popular server-side languages.

I'm not saying PHP is going away this year or the year after that, but consider that some languages that go back to the 50s (Lisp) are enjoying newly revived popularity (Clojure). Do you really think this would happen to PHP in 2050?


I use plenty of javscript and PHP at work. They are poorly designed languages, IMO. (I am not an expert, but I'm familiar with many languages and I always read up on such topics)

>Jesus christ guys.

Despite the poor design considerations and wanting to kill off some of these languages, (or-rehaul them and not being able to) many of us still have to use them day-to-day. This is one of those things that convinces me that there is a God, and he's got a twisted sense of humor. I can't really explain it otherwise. :p


Regardless whether PHP is a poorly designed language, or if it has some sense of "design" at all, the website should have listed good uses of PHP. There are plenty.


Anything PHP can do, another language can do better.


I don't agree. PHP is fast, in development and in execution, and has a wide range of libraries (sort-a) built in to it. If you need the 1.000th prime number, a list of every possible name with 4 characters, or a working webpage, PHP offers it all.

Of course, if you take each case individually, you might want to consider other languages. But having to learn another ten programming languages which are slightly better for a job than PHP is, costs a lot of time and effort.

PHP is a great language, if you get used to the weird and inconsistent function names.


> costs a lot of time and effort

This is where I disagree strongly: as a programmer you should already know all ten of them [languages] and constantly be on a look out as to which of them use where. While in time my set of immediately usable for not trivial tasks languages was morphing significantly, I tried to keep my toolbox full, maintaining a solid 6 (my mind seems comfortable with that many) languages ready for work.

There are some minor points I disagree with, for example, Python, Ruby, Perl and node package managers are all very good, while PEAR is/was a pain to use (a pain: I couldn't install desired package in a minute on the first try) and so on, but it's irrelevant: what I object to is a notion that it is not worth knowing or using different tools because the one you know already "offers it all".


All I'm trying to say is, I like PHP, I use it a lot for 'daily use'. That is, programming small things for personal use. I gave some examples earlier.

And as I said, there are situations you'd think of another language than PHP, but that doesn't mean programming in PHP is a bad practice.


> but that doesn't mean programming in PHP is a bad practice

Of course not! We are agreeing on this - I'm just noting that programming exclusively in PHP (or any other language for that matter) is bad practice. I have nothing (or not very much) against PHP :)


Really? Hmm I should do a weekend project for code battles...


I think there's an inherent tension between the properties of a language that make it seem approachable to novices and those that make it suitable for large, complex programs. A good example is the way that novice languages try to gloss over the differences between the various common representations of numbers: integers, floating point numbers, and numeric strings.

Compounding this problem is the fact that the people who feel naturally most motivated to create languages for novices are often those who are not too far removed from their own experience of learning to program. They are thus not as well informed about language design problems and solutions as we might wish. On the other hand, computer scientists who have that background tend to be more concerned with writing and maintaining large, complex programs, since that's the problem they're faced with all the time, and to have forgotten the difficulty of first learning to program -- or if they haven't forgotten it, they at least realize that that was the easy part.

We've seen this pattern enough times now, where languages get widely used despite their designs being excoriated by the cognoscenti, that I think it can't be written off to accidents of history. Cobol, Basic (in multiple incarnations), Fortran, and now PHP and JavaScript -- I'm sure I'm forgetting some. Anyway, the point is, there has to be some reason this keeps happening.

If I'm right, then the only way we'll get beyond it is if enough kids learn some programming in elementary school, more or less, and do a fair amount of programming in high school, so that by the time they hit college they're past the initial hump and are ready to start learning about software engineering, which is fundamentally the management of complexity. It's very difficult to appreciate the need for "bondage and discipline" until you've worked on a codebase where things that should have been simple turned out to be difficult or impossible.


> But then at least that should have been written on the page.

As of this comment,

  #12 is I would use this language for a web project.
  #14 is I know many other people who use this language.
  #16 is I learned this language early in my career as a programmer.
  #17 is This is a mainstream language.


If you scroll down far enough to "all statements," yes. But none of these are popular apparently.


... all or nothing, huh?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: