News for hackers. Stuff that matters.
Re:PHP Addiction by maratd on Friday June 29, 2012 @02:39PM (#4178288)
You wrote a well thought out response. I owe you a response in kind.

People have a tendency to overrate their rational capacity to reason out a viable decision. While you listed a few solid critiques, the situation is infinitely more complex.

And by infinitely, I do mean exactly that. As in, beyond your capacity to reason it out.

In the end, the only right decision is a decision which withstands the test of time. Both Apache and PHP have done that and continue to do so.

Apache holds 65.5% of the market [1]. PHP holds 77.9% of the market [2].

Those solutions are working, right now, for all of those people. That's reality, not grand "rational, non-masochistic" theories.

[1] http://w3techs.com/technologies/details/ws-apache/all/all [2] http://w3techs.com/technologies/details/pl-php/all/all

Now that we're finished with that, I'm going to enjoy myself.

> a architectural decision which made it nearly fundamentally incapable of solving the C10K problem.

C10K is not a problem and never was. The limiting factor in the overwhelming majority of deployments is the pipe. Apache can saturate the pipe just as well as NGINX. You will saturate the pipe long before you reach 10K connections. Which is why people continue to use Apache. Being technologically superior is pointless when there are no real-world benefits to that technological superiority.

On top of that, Apache's thread model provides it with greater stability. If a worker thread crashes for whatever reason, another will simply spin up. If your NGINX process dies, you'll need to wait until your monitoring solution brings it back up. Which could be a long time.

> PHP is among the worst languages most sane programmers have ever used.

Worse than COBOL? Yes, yes, a fractal of bad design! Except that article was written by somebody who doesn't have much experience in PHP and most of those complaints don't apply to the current stable version. The rest are easily avoided with sane design.

> Python is designed with an emphasis on readability

Was that humor? Python shoves its version of readability down your throat and laughs as you choke on it. Not all of us get off on syntactically significant white-space. In fact, most of us don't. Which explains why Python is so unpopular. But I get, I get it. It's cool.

Re:PHP Addiction by ceol on Friday June 29, 2012 @03:48PM (#4178682)
The first half of your post is basically a long-winded appeal to popularity. Yes, most people on the web use PHP and Apache. Most people on the web also need nothing more than a WordPress installation and their online needs are met. Does that mean WordPress is the best tool out there? You should stop confusing popularity with quality, because the two rarely overlap.

> C10K is not a problem and never was.

Somebody better tell the developers of nginx, Lighttpd, Tornado, node.js, Cherokee, Apache Deft, IIS, and Jetty! All those hours wasted developing solutions to a problem that doesn't exist.

> Which is why people continue to use Apache.

For someone who just decried a situation "infinitely more complex" a few line breaks ago, you sure did generalize the reason millions of servers use a certain piece of software. It couldn't be because Apache has an easier installation on most of the common distros or that cPanel/WHM, the most-used virtual hosting control panel, only supports Apache as its web server. It also couldn't be because of mod_php.

This all stems from your conflation of popularity with quality. PHP did not become popular because it was good. It became popular because it was easy to learn and run.

> Except that article was written by somebody who doesn't have much experience in PHP and most of those complaints don't apply to the current stable version. The rest are easily avoided with sane design.

Most of his criticisms were completely valid, so I'm not sure where you're getting the author doesn't have much experience in PHP. Which ones have been fixed in the current stable PHP? And which ones can be avoided "with sane design"?

> Which explains why Python is so unpopular.

Now I know you're spouting nonsense: https://github.com/languages/

Re:PHP Addiction by wvenable on Friday June 29, 2012 @05:23PM (#4179163)
> Most of his criticisms were completely valid

Not even close. The author trolled through a bunch of other misinformed articles, copied some them verbatim mistakes and all. He doesn't know PHP and didn't research anything.

> Which ones have been fixed in the current stable PHP? And which ones can be avoided "with sane design"?

http://news.ycombinator.com/item?id=4177516

Re:PHP Addiction by ceol on Friday June 29, 2012 @09:17PM (#4180058)
In regard to his "objects compare higher..." point, I think he was referring to this:

    class MyClass {}
    class YourClass {}

    $myclass = new MyClass();
    $yourclass = new YourClass();

    var_dump($myclass > $yourclass); // false
    var_dump($myclass < $yourclass); // false?
In regard to his "there's no pass-by-object identity..." point, there's no way to do this:

    class MyClass {}
    
    $myclass = MyClass;
    $anotherclass = $myclass();
I really don't have the energy to refute the rest, but most of them are relatively subjective. (I say relatively because most of them promote better programming, but their absence doesn't directly harm)
Re:PHP Addiction by wvenable on Friday June 29, 2012 @11:37PM (#4180432)
> In regard to his "objects compare higher..." point, I think he was referring to this:

That all comparisons between objects, except equals and strict equals, return false doesn't seem terribly unreasonable.

> In regard to his "there's no pass-by-object identity..." point, there's no way to do this:

    class MyClass {}
    $myclass = new ReflectionClass('MyClass');
    $anotherclass = $myclass;
    $instance = $anotherclass->newInstance();

    $myclass = 'MyClass';
    $instance = new $myclass();
> I really don't have the energy to refute the rest, but most of them are relatively subjective.

I think you'll be hard pressed to find too much fault with my criticisms of that article. The author doesn't even know common language terms like private/public/protected. And clearly he's never even seen C++.

Re:PHP Addiction by ceol on Saturday June 30, 2012 @11:54AM (#4181932)
> return false doesn't seem terribly unreasonable.

It should throw an error, not return false. This goes back to PHP's "try as hard as possible to run the script" mentality.

The author doesn't need to know C++ to comment on PHP's failings, does he? And he knows private/public/protected— you even quote him using them. You're probably not familiar with Python, but there aren't any private methods (aside from double underscored-prefixed methods, but that's not entirely the same). That's where he was coming from. It's not that he doesn't know those terms; it's that he thinks that's how they should work.

Judging by your other responses, you're quick to toss out whether someone is a "PHP programmer" or not, as if that has any bearing on their argument. I'll tell you right now, I work in PHP five days a week, and I agree with most all of eevee's points.

Re:PHP Addiction by wvenable on Saturday June 30, 2012 @01:45PM (#4182269)
> It should throw an error, not return false. This goes back to PHP's "try as hard as possible to run the script" mentality.

I don't disagree. Although I think this goes towards PHP weak typing not it's try as hard to run the script.

> It's not that he doesn't know those terms; it's that he thinks that's how they should work.

He thinks they shouldn't exist at all. Which is one philosophy but that's not a valid criticism.

> I'll tell you right now, I work in PHP five days a week, and I agree with most all of eevee's points.

Even where he clearly doesn't know what he's talking about and didn't try the code he was supposedly saying doesn't work?

Those who don't know their tools are bound to have more problems or believe things that are just wrong.

Re:PHP Addiction by batista on Saturday June 30, 2012 @02:49AM (#4180950)
>The first half of your post is basically a long-winded appeal to popularity.

No it's not. We're not talking about music --how popular Bieber is vs Bach, for example. So he didnt just say "tons of people use PHP", he said "tons of people use PHP and it solves their problems giving results".

This is not an "argument by popularity", its an argument by number of empirical verifications. Which is supposedly what engineering and science is all about.

On the other hand your arguments are appeals to "logic", "theory", etc, eg idealism and elitism in the face of actual results. "That's (eg python) is how a language should be, and not like php" etc. All the while forgetting to take no account practical, verified, php benefits.

>Yes, most people on the web use PHP and Apache. Most people on the web also need nothing more than a WordPress installation and their online needs are met. Does that mean WordPress is the best tool out there?

OIf it meets their needs and has them happy, of course! Anything else would be dellusional to say.

Re:PHP Addiction by ceol on Saturday June 30, 2012 @11:38AM (#4181880)
> So he didnt just say "tons of people use PHP", he said "tons of people use PHP and it solves their problems giving results".

The original discussion was about whether PHP was a good language. He came in and said, "It is because look at all the people who use it! Obviously it's fine!" That's an appeal to popularity.

> On the other hand your arguments are appeals to "logic", "theory", etc, eg idealism and elitism in the face of actual results.

What results? We're not talking about Mom & Pop's Homepage, here. Posting about how most sites run on PHP doesn't help us when we're not talking about most sites. We're talking about building apps.

Re:PHP Addiction by flatline3 on Friday June 29, 2012 @04:10PM (#4178791)
Reading through your responses, I'm curious about how much experience you actually have in our industry. Most of what you claim is easily falsifiable.

The idea that C10K doesn't matter is definitively untrue. I've worked with numerous large systems (games, content) where Apache was the problem, and swapping it out was the solution to making maximal use of the hardware and the (gigE+) pipes.

Even outside of saturation, there are large-scale systems that benefit from being able to park an open socket and provide asynchronous notifications over that socket (in web terms, think websockets). If you're paying for a thread or process for every socket, this becomes prohibitively expensive very quickly.

It's also not an unusual use case outside of traditional web development, and now with websockets, this kind of architecture is likely to see considerably more use. This approach provides numerous advantages to legacy polling approaches, but does not work on traditional short-lived connection software architectures.

In addition to the above, your discussion of robustness really has no bearing on Apache's architectural suitability in production use-cases.

Auto-restart functionality exists for other architectures, and in addition to that, it's standard practice to deploy multiple servers with automatic failover behind a load balancer -- in addition to the server process itself, the OS can crash, disk drives can fail, power supplies can blow, etc.

Additionally, you shouldn't have production processes crashing regularly, and shouldn't be making significantly performance-impacting architectural choices on the basis of Apache's ability to restart a child process. Software crashes in production are a worst-case failure, akin to a drive failing, and should never be so common as to justify Apache's performance costs/constraints.