News for hackers. Stuff that matters.
Re:Coding Horror: The PHP Singularity by bobsy on Friday June 29, 2012 @07:25AM (#4176112)
Sorry Jeff. The only thing broken with PHP is you (and other people like you).

How much PHP do you use Jeff? Lets assume none. How is PHP hurting you? I mean seriously, how much contact do you even have with PHP?

PHP is easy to learn, easy to make websites with. There are a tonne of paying jobs which require PHP. PHP runs a lot of websites.

I am a PHP developer. I prefer Python but my PHP job pays me just fine. There are a lot of things about PHP that I don't like but it gets the job done just fine. You can write reasonable code with PHP. You can write secure code with PHP.

The main people who have problems with PHP are either ex-PHP developers who usually have gone on to Ruby and look back and fire a few shots at PHP. Or people like Jeff Atwood. Undeniably smart and talented programmers who for some reason are irked by the mere existence of PHP.

Please get over yourself.

Re:Coding Horror: The PHP Singularity by kev009 on Friday June 29, 2012 @08:05AM (#4176212)
The "problem" is that PHP's popularity breeds more popularity, uninformed choice, and single-language programmers that only know PHP (a real tragedy!). Bashing PHP is in a serious sense a public service if it can reduce any of these outcomes.
Re:Coding Horror: The PHP Singularity by trebor on Friday June 29, 2012 @09:08AM (#4176391)
I don't fit in your box. And I still think PHP is a decent language for introducing people to programming.

I've written web apps in: Ruby (both Rails and Sinatra), Javascript (Node.js with Express), PHP (my own framework, CodeIgniter, and eying Laravel), and been maintenance programmer for a C CGI application. I've written desktop and CLI apps in Object Pascal (Lazarus and Delphi), to CLI apps in Go, C++, and probably a few I've forgotten. I've done Object Oriented, Evented, and to some degree Functional programming. I am a polyglot programmer.

The problem is bashing PHP. As Jeff said, PHP's power is its ubiquity and its near omnipresence. It runs on just about any platform with any configuration, with almost perfect consistency. For the most part there's no switching extensions or libraries because of the OS. Develop wherever... deploy wherever... get almost an identical experience without lifting a finger.

In fact, I have great hope for the future of PHP with 5.3 and 5.4 as they (finally!) have added and improved upon the language, and have begun to cull deprecated features. The problem for PHP right now is twofold: web hosts refusing to upgrade in a timely fashion, and legacy codebases that refuse to be rewritten. Both these are demanding backward compatibility, and slowing the advance of PHP.

I'm tired of the bashing of PHP. Bashing, in general, is the absolute least effective way to communicate your point. At least Jeff Atwood is attempting to do something.

Re:Coding Horror: The PHP Singularity by anon01 on Friday June 29, 2012 @08:17AM (#4176235)
Yes, because PHP monoglots have their homepage set to codinghorror.com and browse right over to Hackernews afterwards. It is not a public service, it is a waste of screen space.

The startup scene's dirty little secret is that (anecdotal from several local companies I've worked for and/or collaborated with) PHP development is fast and cheap. Once you have proven you can solve a business problem and get funding, then you can decide if you really need to do a re-write.

There are just too many small companies focusing on real problems(instead of what language their webapp is built in) to make me think PHP is evil or that Rasmus Lerdorf is a bad person.

Re:Coding Horror: The PHP Singularity by troels on Friday June 29, 2012 @08:13AM (#4176222)
So, the problem with PHP is that it is popular? I guess it was the same crime that Java committed 10 years ago. And C++ before that.

Makes sense - There's definitely a pattern of bashing the popular languages.

Re:Coding Horror: The PHP Singularity by brudgers on Friday June 29, 2012 @08:37AM (#4176297)
The problem isn't that it's popular - television programs about Bigfoot are popular, too. The problem is that PHP is extremely useful and easy to use in addition to being widely used.

Reading the article, I was struck by its similarity in structure and language to classic Windows bashing rants of the past two decades - i.e. "the problem with PHP is that it has no taste." In fairness, the call to action is radically different; to build rather than to buy something.

Re:Coding Horror: The PHP Singularity by troels on Friday June 29, 2012 @08:58AM (#4176362)
Well, I doubt it would ever become popular if it wasn't useful and easy to use.

Actually, I think it is exactly because it's popular. All languages have odd ends, but you rarely hear people rant over Pythons lack of lambdas and weird explicit "self" parameter or Ruby's incomprehensible scoping rules. I'm betting that once they fall out of fashion, we will.

And no, I disagree. The main sentiment of the article is negative. It's a call to figure out how to dethrone PHP, but without telling us why this would be such an important goal.

Re:Coding Horror: The PHP Singularity by brudgers on Friday June 29, 2012 @11:07AM (#4176960)
>"Well, I doubt it would ever become popular if it wasn't useful and easy to use."

Like Windows 3.1?

Re:Coding Horror: The PHP Singularity by mikeash on Friday June 29, 2012 @11:07AM (#4176962)
I hear about them a lot. The difference is that PHP is so much worse. Yes, every language has warts. But PHP is the only popular language I know of which is essentially nothing but warts.

Of course that's subjective, and people disagree, but there really does seem to be a real, qualitative difference between the warts on a mostly nice language like Python, and the ubiquitous bizarro world that makes up just about the entirety of PHP.

Re:Coding Horror: The PHP Singularity by wvenable on Friday June 29, 2012 @12:05PM (#4177321)
> But PHP is the only popular language I know of which is essentially nothing but warts.

This is entirely untrue. PHP isn't even a bad language on the scale of actual bad languages. It has some warts but they don't really impede the development of good software. There are many languages that make developing good software nearly impossible.

Re:Coding Horror: The PHP Singularity by mikeash on Friday June 29, 2012 @02:58PM (#4178402)
What other popular language is as bad? COBOL?

I don't know about impeding the development of good software. Warts can always be worked around as long as you know about them and how to handle them. But that doesn't mean they don't matter, and PHP has so many that it's difficult to enumerate them.

What other popular languages silently convert strings to floats and then do math or floating-point comparisons on them? What other popular languages have literally hundreds of failing unit tests in their mainline implementation, allowing ridiculous and insecure regressions that were actually caught by testing but never noticed to ship in an official release?

I doubt there's any one wart that's exclusive to PHP. What's remarkable about PHP is how it manages to gather so many in one place. Each one alone is not that bad, but the sheer number of them is astounding.

Re:Coding Horror: The PHP Singularity by wvenable on Friday June 29, 2012 @03:08PM (#4178468)
> What other popular languages silently convert strings to floats and then do math or floating-point comparisons on them?

JavaScript. Most of the "issues" around comparisons/conversions/etc equally applies to JavaScript as it does to PHP.

But PHP does some very stupid casts but it's really just one problem. In the lists of "failures" tend to show that same problem 15 different ways to show how screwed up things are. If your code is well designed and secure you don't encounter these problems anyway.

> What other popular languages have literally hundreds of failing unit tests in their mainline implementation...

I'll give you that. Since that happened, the PHP developers have worked to ensure it won't happen in the future. No platform is free of particularly big security fails (Rails).

Re:Coding Horror: The PHP Singularity by mikeash on Friday June 29, 2012 @03:20PM (#4178534)
Yes, JavaScript has the same string comparison problems as PHP. And it gets a ton of criticism for it. JS doesn't have all these other problems, though.

For the unit tests, it looks like there are still 100 unexpected failures in the latest release:

http://gcov.php.net/viewer.php?version=PHP_5_4&func=test...

Am I misinterpreting that?

Yes, no platform is free of security problems. But the way a security problem happens is as important as what the problem is. That PHP's unit tests are so noisy that important regressions can't even be noticed even when a test exists to catch them speaks extremely poorly of PHP compared to other languages.

Re:Coding Horror: The PHP Singularity by wvenable on Friday June 29, 2012 @05:17PM (#4179141)
I actually clicked on several of those failed tests and there doesn't seem to be anything critical there. Looks like some access problems (test setup) and at least one needed the test to be updated.

I'm not sure when these where run but it would be easy for someone went through all of them and give them a pass. A failed test doesn't necessarily mean that deployment should be held up. 700 failed tests is a different story.

> JS doesn't have all these other problems, though.

JavaScript has plenty of it's own problems. It has legacy things you should never do. PHP has different problems (not necessarily worse ones) and things you should never do. Lists of the horrors of PHP generally include all things you shouldn't ever do mixed together to make it look much worse than it really is.

I've seen similar lists made for JavaScript (you can get some really crazy results) but that doesn't mean shit for day to day use.

Re:Coding Horror: The PHP Singularity by mikeash on Friday June 29, 2012 @05:54PM (#4179311)
The fact that the tests would be easy to fix makes it worse, no better. The problem the tests and the security hole was not that the tests indicated severe problems, but that all these simple failing tests masked the presence of a new, serious failure. If your test output is filled with junk due to failing tests because of minor bugs, it makes it much harder to notice when your tests uncover a major regression.
Re:Coding Horror: The PHP Singularity by wvenable on Friday June 29, 2012 @06:11PM (#4179383)
> The fact that the tests would be easy to fix makes it worse, no better.

Somebody has to fix them; these things don't happen instantly.

Given the fact that they had hundreds of failed test cases and now they only a few is a significant improvement -- and this is while development has continued. They realized the problem just as you describe; there isn't much more to say about it except they're working to fix it.

Re:Coding Horror: The PHP Singularity by scribu on Friday June 29, 2012 @07:28AM (#4176118)
Hey, at least he's not just ranting like everyone else; he's trying to bring forward a better alternative.

I'm also a PHP dev and I think Python is the safest bet, since it has good support on all platforms already (including Windows).

Re:Coding Horror: The PHP Singularity by RobAley on Friday June 29, 2012 @10:20AM (#4176698)
He started with a highly contentious premise that he declared as fact.

Many, like me, disagree with that premise, and so consider that he is at best trying to fix a problem that either doesn't exist or doesn't require a drastic fix like he proposes, or at worst is very cleverly tapping into a vein of contention to hype an up-coming product.

The thing is, with those who do genuinely rant against PHP, at least we can have a useful debate with them over the issues. The "PHP is rubbish" posts that feature here regularly almost always lay out their arguments and basis for coming to that conclusion, from which useful (if sometimes repetitive!) discussion can ensue.

I think that the better alternatives, in the general case, are to participate in (or even fork) PHP and bring about the change together.

Re:Coding Horror: The PHP Singularity by scribu on Friday June 29, 2012 @10:35AM (#4176753)
Very well put.
Re:Coding Horror: The PHP Singularity by fusiongyro on Friday June 29, 2012 @10:32AM (#4176734)
So, a couple sentences admonishing the masses to write something better plus one oblique reference to him "trying like hell to make it happen" equals "trying to bring forward a better alternative"?

Show me the fucking code, Jeff.

Re:Coding Horror: The PHP Singularity by dasil003 on Friday June 29, 2012 @08:04AM (#4176211)
It read like a pretty vanilla rant to me.
Re:Coding Horror: The PHP Singularity by mavroprovato on Friday June 29, 2012 @08:43AM (#4176319)
Probably because you did not read the last part of the article where he says that he's trying to build a better alternative.
Re:Coding Horror: The PHP Singularity by dasil003 on Friday June 29, 2012 @06:06PM (#4179358)
Except I did. I read every word.
Re:Coding Horror: The PHP Singularity by gaius on Friday June 29, 2012 @08:13AM (#4176227)
You see, once they learn Ruby, they're "rockstar ninjas" and can't wait to tell everyone.
Re:Coding Horror: The PHP Singularity by andreasvc on Friday June 29, 2012 @09:37AM (#4176526)
I don't have to deal with PHP directly but to me it just doesn't feel right when for example you learn about financial websites being built in PHP (as in an HN submission the other day). All these strings being accidentally treated as integers or floats and vice versa, without a decent way of handling errors, it feels like building a skyscraper on a fault line and not worrying about making it earthquake proof. Even if I'll never have to set foot in it, I'll still complain.
Re:Coding Horror: The PHP Singularity by louischatriot on Friday June 29, 2012 @08:38AM (#4176303)
It's true that PHP gets the job done, that it's easy to learn and very easy to set up. This makes for a perfect "introduction to the web" language.

Which is why I began developping websites with it. But at some point, I felt like it was preventing me from really understanding what was going on behind the scenes, and I moved away from GRails and now nodejs.

I don't hate PHP but I think Jeff's last point is good: we need framework as easy to learn and setup, but that lets you understand how the web really works.

Re:Coding Horror: The PHP Singularity by Maascamp on Friday June 29, 2012 @12:01PM (#4177293)
I'm sorry, you switched from writing your backend in PHP to writing it in Javascript because you believe Javascript let's you more fully understand what's going on behind the scenes?

I'm quite curious as to your understanding of how the web really works.

Re:Coding Horror: The PHP Singularity by billpatrianakos on Friday June 29, 2012 @09:14AM (#4176422)
"I prefer Python". Why did you say that? To me it feels like you said it do people would take you seriously as a "real" developer. Because surely a "real" developer wouldn't actually enjoy using PHP or use it unless they were forced, right?

I agree with your point and I just wanted to add that the fact that we have to add in little details like "I prefer Python" just to be taken seriously says more about hacker elitism than it does about PHP.

Re:Coding Horror: The PHP Singularity by polyfractal on Friday June 29, 2012 @09:26AM (#4176474)
"I walk to work because there are no bike paths, but I prefer biking."

Why did you say that? To me it feels like you said it so people would take you seriously as a "real" biker. Because surely a "real" biker wouldn't actually enjoy walking unless they were forced, right?

Re:Coding Horror: The PHP Singularity by bobsy on Monday July 02, 2012 @03:50AM (#4187817)
I get what you are saying, I didn't add this to be taken seriously. I am not bothered if I am taken seriously or not. I had an opinion which I couldn't keep to myself. Upvote / downvote / flag and ban the account. I am not massively bothered.

I do genuinely prefer Python. I picked it up when Django first started making noise and I really enjoyed working with Python (not so much Django). Now I mainly use Python to mess around with PyGame.

Its not a difficult to thing to say. For all of PHP's ease there are little niggles which get you down. Really simple things. Is a function called functionname or function_name. Is it ($needle, $haystack) or ($haystack, $needle).

Python is neater and I like neat.

Re:Coding Horror: The PHP Singularity by dberg on Friday June 29, 2012 @09:18AM (#4176437)
damn, that was spot on.
Re:Coding Horror: The PHP Singularity by batista on Friday June 29, 2012 @12:18PM (#4177408)
Or he said it because he does prefer Python.

Thought of that, Sherlock? Or should I say Bekas?