News for hackers. Stuff that matters.
Re:Taking PHP Seriously by brian-armstrong on Thursday October 13, 2016 @05:59PM (#12704415)
I'll offer an alternate hypothesis.

Some companies are succeeding in spite of php. There are many, many users of php, and we'd expect that there would be considerable variance, with some users doing awful (no traction, buggy sites, etc) and some hitting home runs (facebook). Because it's such a popular language, it will have users across this entire spectrum.

It's easy to cherry-pick the winners and miss all of the tremendous losers who picked php and got nothing for it.

Re:Taking PHP Seriously by increment_i on Thursday October 13, 2016 @11:29PM (#12705963)
It would be an outlier company indeed who held an 'all hands on deck' meeting and said, "We're succeeding in spite of PHP everyone!"

Only engineers care about programming languages. Seriously. That's it. No one else cares about them. I work in a large public university alongside a revolving door of student interns who are always 19. In 10+ years of work, I've still yet to meet the person who talked about their favourite website or app, but lamented that it was written in Php or JavaScript or Go or Java. It's only us (the HN'ers) who fret about this.

Don't believe me? Imagine the look on everyone's faces at the tech publishing houses around 2009 when books about Objective-C sold a few hundred copies a year to doing tens of thousands per month when the iPhone rocked the world. This happened without a proper language hot stove on Hacker News, no?

People care about outcomes. People care about products. People care about being dazzled. People care about showing their friends this incredible thing they saw on the web/this new app.

Re:Taking PHP Seriously by ddw on Friday October 14, 2016 @12:27AM (#12706136)
But program managers and CTOs and other non-engineers at a company care about scalability, performance, technical debt and quality, right? Let's not pretend that these don't matter once you've gone past the "users actually care about our app" phase, because they do and they affect the bottom line of a company. And IMHO PHP falters in these regards.
Re:Taking PHP Seriously by increment_i on Friday October 14, 2016 @12:37AM (#12706161)
At this point, I would have no problem arguing with a straight face that your choice of technology stack might be the least important factor in whether your business succeeds or fails. I don't mind if I get torched for this, it's just my current, non-Silicon Valley, non-substantiated opinion at this time (though I don't think it's without merit).
Re:Taking PHP Seriously by riprowan on Friday October 14, 2016 @03:09PM (#12710378)
> But program managers and CTOs and other non-engineers at a company care about scalability, performance, technical debt and quality, right?

Rarely. Mostly they care about meeting quarterly goals and budgets; and ease of finding inexpensive, more-or-less competent talent. In both of these, PHP excels.

I'm currently maintaining an app stack for a Fortune-100 company that, if I told you what it was, you simply wouldn't believe I was telling the truth. That's how out of date it is. "Scalability, performance, technical debt and quality" never entered into it. All anyone ever cared about was "does it get the job done and what does it cost to keep it running for another year as-is?"

Re:Taking PHP Seriously by bmj on Friday October 14, 2016 @03:27PM (#12710471)
I'd upvote this many time if I could. I am in the same boat--my team helps maintain a ten year old web application that is used by the largest companies in our domain. The application is literally the backbone of data used by these companies to make money. We have reliability issues, and sometimes clients get a little upset, but every year it is the same thing: how much do we need to budget for support?
Re:Taking PHP Seriously by TeMPOraL on Friday October 14, 2016 @04:32PM (#12710884)
> Rarely. Mostly they care about meeting quarterly goals and budgets; and ease of finding inexpensive, more-or-less competent talent. In both of these, PHP excels.

This. In my previous job, I was literally told by my boss, that they'd consider switching from PHP to something like Ruby or whatever, but PHP programmers are cheaper so that's why they stick with it.

Re:Taking PHP Seriously by ransom1538 on Friday October 14, 2016 @10:38AM (#12708340)
Performance? You need to update your act. PHP7 is 3x faster than python and now faster than Java 8 . The only people that can call php slow are masochistic c++ web hacks.

https://blog.famzah.net/2016/02/09/cpp-vs-python-vs-perl-vs-...

Re:Taking PHP Seriously by pritambarhate on Friday October 14, 2016 @03:19PM (#12710434)
This benchmark shows things a little bit differently.

http://benchmarksgame.alioth.debian.org/u64q/compare.php?lan...

But I think, what's important to note is that PHP 7 has improved in speed department by a great deal.

Re:Taking PHP Seriously by Shanea93 on Saturday October 15, 2016 @03:46AM (#12713147)
It's probably worth mentioning that the regex-dna test time is kind of incorrect and provides an inaccurate view of what's happening.

Java-8 is using java.util.regex which is written in Java, PHP is passing the regex requests to it's own regex process which is actually a C package and performs a lot faster.

What we're actually comparing here is:

time(java.util.regex) > time(php compilation + c regex package)

Re:Taking PHP Seriously by igouy on Tuesday October 18, 2016 @02:58PM (#12737566)
> Java-8 is using java.util.regex <

No, the fastest Java program shown does not use java.util.regex

The fastest Java program shown uses com.basistech.tclre

> a C package and performs a lot faster <

You're welcome to contribute a Java program that uses the PCRE library --

http://benchmarksgame.alioth.debian.org/play.html

Re:Taking PHP Seriously by spronkey on Monday October 17, 2016 @05:00AM (#12723544)
PHP's execution performance is highly dependent on whether you are piggybacking the C implementations, or pure-PHP ones. That said, this is still a correct benchmark, if your use case involves a lot of regex.
Re:Taking PHP Seriously by igouy on Tuesday October 18, 2016 @02:48PM (#12737469)
Perhaps the problems are with the way the Java program is written and run?

Back in 2012:

"5) The idea is to help you understand that you aren't comparing what you say you're comparing.

If your intention is to compare time taken to grow a list, then shouldn't you start with lists that are the same size, and start with program heap that's the same size, and use the same max heap size?

        user+sys for your Java program = 20.56s
But change

        ArrayList<Integer> s = new ArrayList<Integer>();
to

        ArrayList<Integer> s = new ArrayList<Integer>(8192);
and run with

        java -Xms1G PrimeNumbersBenchmarkApp

        user+sys  = 6.9s
I don't think you're comparing what you say you're comparing."

http://www.famzah.net/download/langs-performance/java-discus...

Re:Taking PHP Seriously by tigershark on Friday October 14, 2016 @06:07PM (#12711489)
I don't care about performance. Unless we are speaking about orders of magnitude and my use case has an absolute need for performance. If I only cared about performance I would write everything in assembly optimised for every specific architecture. But strangely I'm much, much, much more productive writing in c#, Java, groovy, f#, ruby and whatever language is appropriate for what I need to do at a certain time. For sure I won't start a new project using a language in which writing such abominations as accessing the database in the presentation layer is not even discouraged, but it is actually encouraged and taken as an example on HN in this thread. Enjoy your marvellous php. But please stop the bullshit that pushed a lot of people to use that franken-language rather than using a better approach.
Re:Taking PHP Seriously by Shanea93 on Saturday October 15, 2016 @03:38AM (#12713128)
Most professional PHP developers I've anecdotally worked with use a Model-View-Controller pattern these days, where the SQL is abstracted away in the model under something like Doctrine2-DBAL, Propel2 or PDO. If I was hiring for a developer and they suggested putting raw SQL in the view layer, I would reject them. If I received a pull request from my team which did the same, I would reject it.

You seem unnecessarily argumentative about this, almost like you're angry and I really don't understand why. There really isn't that much difference between languages like Ruby and PHP to warrant this and almost anything can be expressed in almost the same way, the only real differences are syntactic sugars and the "flexible" type system.

Re:Taking PHP Seriously by ufmace on Saturday October 15, 2016 @09:51AM (#12713911)
This exactly. Never been a PHP developer, but I did get handed a PHP webapp to copy some functionality out of for a replacement C# webapp. I was a little surprised to find out that it was written in a rather Rails-like architecture using some PHP MVC library, I think it was CakePHP. Rails was a hit, and a great step forward in web development, so naturally every other language copied as much of it as possible, including PHP. There may be plenty of weird quirks about the language still, but at least the architecture is much improved.
Re:Taking PHP Seriously by sethrin on Saturday October 15, 2016 @09:07PM (#12716345)
Many/most PHP platforms these days do claim to be either MVC or Rails-based or both. CakePHP is not a bad example there. There are however a few other very large projects whose take on MVC is lacking to some degree. Drupal is not bad, Joomla is worse, and of WordPress the less said the better. Note also that those projects are listed in order of increasing popularity.

Modern PHP frameworks and tools are good, perhaps even excellent. Composer and the PSR-# efforts have spurred a renaissance in code quality and interoperability, and PHP7 brings some truly impressive speed improvements. For those of us who aren't stuck supporting legacy code, that is. One of these days I will be working with a language whose syntax I enjoy, but until then the language that puts the "sin" in "syntax" will (for better or worse) keep getting the job done.

Re:Taking PHP Seriously by vancouverwill on Monday October 17, 2016 @03:37PM (#12728716)
Performance is directly related to profit on consumer apps. See http://glinden.blogspot.co.uk/2006/11/marissa-mayer-at-web-2...

plus like you say PHP might be faster to get started with but becomes much slower on larger projects due to inconsistent error handling and language design.

Re:Taking PHP Seriously by jbergens on Friday October 14, 2016 @11:12AM (#12708589)
Funny that people complain about js performance. In this benchmark it was 3 times as fast as php7 and about 7 times as fast as java 8. Have not checked the details of the benchmark yet.
Re:Taking PHP Seriously by juliangoldsmith on Friday October 14, 2016 @11:50AM (#12708891)
It's worth noting that it's compiled JavaScript vs. interpreted PHP. With something like HHVM the PHP version would likely be a lot faster.
Re:Taking PHP Seriously by secoif on Saturday October 15, 2016 @01:48PM (#12714936)
Compiled JavaScript?
Re:Taking PHP Seriously by niutech on Tuesday October 18, 2016 @01:35PM (#12736829)
I think he meant JIT compilation.
Re:Taking PHP Seriously by icedchai on Friday October 14, 2016 @07:42PM (#12711859)
Looks like you're reading that wrong? Java 8 is listed twice. Java 8, when using the non-standard library version of the program is second only to C++. This is pretty much as expected.
Re:Taking PHP Seriously by igouy on Tuesday October 18, 2016 @03:08PM (#12737667)
> Have not checked the details of the benchmark yet. <

"Will your toy benchmark program be faster if you write it in a different programming language? It depends how you write it!" ;-)

Re:Taking PHP Seriously by magic_quotes on Friday October 14, 2016 @10:04PM (#12712407)
> now faster than Java 8

Don't trust everything you read on the internet, run the benchmark yourself and see if that result is actually reproducible. (Depends on the heap size.) There is also a "non-std lib" java test case, which doesn't generate as much garbage and, of course, performs much better.

Re:Taking PHP Seriously by yxhuvud on Friday October 14, 2016 @03:24AM (#12706582)
Managers caring about technical debt? You must live in a parallel universe. They may care about maintenance costs, but that is not really the same thing.
Re:Taking PHP Seriously by ddw on Saturday October 22, 2016 @06:47AM (#12768189)
They don't until things break, your app can't handle the amount of requests coming in, can't insert and fetch data in a reasonable amount of time, etc.

It's at this point that shit falls apart and the manager starts to care about these technical choices and all of the time and money that will be needed to be spent to rewrite.

Call it maintenance costs if you want but those costs are directly affected by the technology decisions you make.

Re:Taking PHP Seriously by novaleaf on Friday October 14, 2016 @09:44AM (#12707993)
the end result of technical debt ==> maintenance costs makes it same enough.
Re:Taking PHP Seriously by GFischer on Saturday October 15, 2016 @08:18PM (#12716229)
Looking at things from the other side: being a manager and trying to sell projects to reduce technical debt is really freaking hard in a world of short-term outlooks and revolving door of CEOs that want to improve numbers this quarter or the next, not a few years down the road.
Re:Taking PHP Seriously by sqeaky on Monday October 17, 2016 @10:28AM (#12725290)
This is entirely true, but I have never worked with someone beyond the leader of my immediate who though the same. Most managers don't care what cruft is in there when it ships.
Re:Taking PHP Seriously by jwatte on Friday October 14, 2016 @12:45AM (#12706185)
The scalability of PHP is great, because each request is fully independent. This is like the Amazon lambda model. You /have/ to put your state in some storage back end, network attached RAM or such. This is a scalability best practice!
Re:Taking PHP Seriously by haimez on Friday October 14, 2016 @01:01AM (#12706226)
Yeah, but you also have to fork a whole process per request to do it.

Process fork, CoW overhead every time you mutate a page, and a full OS thread per request. Oh, and let's not forget negotiating a new database connection per request.

I think by the time you've added up all those overheads, you're not off to a scalable start. It's possible to work around the limitations, but it's not easy.

Re:Taking PHP Seriously by bartl on Friday October 14, 2016 @06:48AM (#12707229)
"fork" is not a major problem in PHP. In Drupal, every single request compiles a file "common.inc", of several thousands of lines of PHP code. That is what slows it down. It's remarkable that PHP still manages to do that in just 100ms.

In Zend Framework it's slightly better because it includes an autoload option, which implies only PHP files that are actually used by athe request, get loaded. That way the overhead is "only" 50ms.

Re:Taking PHP Seriously by ransom1538 on Friday October 14, 2016 @10:43AM (#12708378)
Wow. Is this comment from 2003? Uh. Why don't turn on opcache [1]? PHP7 is fast. Real fast [2].

http://php.net/manual/en/intro.opcache.php

https://blog.famzah.net/2016/02/09/cpp-vs-python-vs-perl-vs-...

Re:Taking PHP Seriously by igouy on Tuesday October 18, 2016 @04:21PM (#12738285)
> PHP7 is fast. Real fast [2]. <

You need a lot more than a "Sieve of Eratosthenes" code snippet to back that up :-)

Re:Taking PHP Seriously by raarts on Friday October 14, 2016 @10:10AM (#12708157)
> In Drupal, every single request compiles a file "common.inc", of several thousands of lines of PHP code.

This only proves Drupal is slow.

Re:Taking PHP Seriously by mtberatwork on Friday October 14, 2016 @07:45AM (#12707458)
> Yeah, but you also have to fork a whole process per request to do it.

Eh, any PHP developer worth their salt is implementing PHP-FPM. The days of forking expensive Apache processes have long been over.

Re:Taking PHP Seriously by xorcist on Saturday October 15, 2016 @05:38PM (#12715761)
The whole reason your Apache was (kind of) expensive to fork was PHP. You've only moved that forking to the PHP-FPM process.

But that said, forking processes is not really a problem unless you do really long lived connections (such as longpoll handlers). Many other languages do that. Not many other languages have kept the CGI-like request model that PHP has, though.

It encourages things like parsing code or even opening database connections on every request, unless you cache them. (Which you probably do if you are a PHP developer. But it's not always as automatic as one would hope. Have you checked your application still fits in the cache you set up?)

Re:Taking PHP Seriously by codedokode on Friday October 14, 2016 @05:25PM (#12711204)
And even whey they were not over yet there was no fork for each request. A pool of workers was forked beforehand, and each worker could handle requests one by one without restarting (only PHP environment is cleared, OS level process is not restarted).
Re:Taking PHP Seriously by justinhj on Friday October 14, 2016 @01:22AM (#12706270)
It is easy if you are just willing to spend more money on servers. Often it's worth it.
Re:Taking PHP Seriously by collyw on Friday October 14, 2016 @03:03AM (#12706522)
Its also a problem that has been solved a long time ago and is well understood. Unlike trendy microservice architectures....
Re:Taking PHP Seriously by haimez on Friday October 14, 2016 @01:28AM (#12706286)
Only if you extract a ton of value per user or can serve a huge number of users per machine. Otherwise, upping the number of servers by an order of magnitude will start requiring an operations team to maintain.

That was a pretty common truism 10 years ago, but machines haven't gotten faster at the same rate lately.

Re:Taking PHP Seriously by nrser on Friday October 14, 2016 @04:15AM (#12706737)
it's the "good problem". and the good problem can always be solved, though lack of reliability can seriously hurt your growth. but that doesn't mean that it's as easy as people make it out to be.

i wrote and ran a big php app (Zynga's Mafia Wars). this is just about the app server (apache + php side), single-master MySQL will give you far greater problems at that scale.

everyone is tearing away adding features, and the code just keeps getting bigger. everything includes everything else. so you can't just start fresh with every request, it takes way too long. so you use APC or whatever. now you have global shared state (and people start using it), but as long as no one really fucks it up that's ok.

php processes are always erring and dying in weird ways that no one can figure out, especially if anyone uses the half-baked OO stuff (circa 2008-9), and tracking down obscure php state errors ranges from difficult to impossible since you're never quite sure when or where something went wrong, but it works for most people most the time, as long as you remember to clear out the error logs so they don't get big enough to crash the box.

memory use still sucks at around 30M a process, meaning you can only have around 500 workers on at 16G RAM server, but it's workable. at least it's not rails.

because it takes a while to talk to even Memcache (go forbid you talk to MySQL) and do all your silly user updates (games are really write-heavy) you are taking a few hundred ms per request, so 16G mem servers (it's 2008) safely top out at around 500-600 req/sec, and i think would melt close to 1000 or so. remember, your throwing everything you have at growth and features so you're not really optimizing shit.

cool, just need more hardware. which is no problem. if you can get hardware. when you're co-located it takes forever to get new hardware online. not really an option. and even the F5 load balancers can only take so much. and there are issue with getting too many app servers talking to too many memcache servers. or something like that. after i left i think they saturated the data drops, which really puts you in a bind.

but that's not a problem now, with cloud services, right? except that those are not limitless either. i think FarmVille ran into a wall where AWS wouldn't / couldn't supply more instances (again, this was around 2009-10 so prob a lot better now). and those are still physical machines in physical datacenters somewhere that will have all the same problems and limitations and then some.

but you're going to have problems with any app runtime at that scale. and php's performance was an order-to-two or magnitude better than rails, and we never figured out how to get significantly complex and traffic-heavy java apps to stop leaking memory. though i'm sure you can. and you will! like i said, it's all solvable. hell, even MySpace didn't fail because of tech infrastructure.

what i'm saying is that php wasn't (and maybe still isn't?) particularly fun when throwing hardware at it doesn't work, and you end up losing a lot of the purity / simplicity of the model because it's too damn expensive. ffs, Facebook re-wrote the runtime. that's what it took for them. and my friends there tell me it's pretty much like writing java at this point. it's a fine choice, but i'd rather not use it again. had a much better time with python before javascript ate the world.

Re:Taking PHP Seriously by dakull on Friday October 14, 2016 @05:11AM (#12706908)
>php's performance was an order-to-two or magnitude better than rails

Again PHP (the language) vs. Rails (the framework).

What framework was that `big php app` using?

Re:Taking PHP Seriously by chriswarbo on Friday October 14, 2016 @05:51AM (#12707039)
> What framework was that `big php app` using?

PHP is a framework. True it's not a particularly nice one, and some people build even more layers on top, but it comes with all manner of HTTP/url/DB/etc. stuff out of the box. It's also a templating language (that's what the "<?php" tags are for); although, again, not particularly great, and some people layer more abstractions on top.

Re:Taking PHP Seriously by bigtunacan on Friday October 14, 2016 @09:20AM (#12707852)
In the sense of comparing PHP and Rails, then no PHP is not a framework. Codeignitor, Laraval, Cake, Yii; those are PHP frameworks and fair comparisons to Rails.

I can (and have) just grabbed Rack and rolled most everything myself in Ruby and it has way less overhead and is much more performant than Rails. Ruby also has it's own templating language; ERB is part of Ruby core.

So comparing PHP to Rails is a bit apples and oranges.

Re:Taking PHP Seriously by nrser on Friday October 14, 2016 @11:45AM (#12708854)
it's a business decision comparison, not a technical categorical comparison. you need something to receive http request and return http responses, and you're comparing different popular (because hiring, training, and available community / support resources) ways to do that. they might be apples and oranges but at that level you're concerned with comparing fruits.
Re:Taking PHP Seriously by bigtunacan on Friday October 14, 2016 @03:02PM (#12710340)
In this case it was a technical comparison; the original poster stated, "php's performance was an order-to-two or magnitude better than rails".

If you are making a technical comparison then it needs to be at the correct layer of abstraction. If we were to compare performance of Laraval and Rails that would be a fair comparison.

If we are comparing on performance then PHP should be probably be compared to Ruby+Rack since that is sort of the lowest common denominator.

I'm not dogging on PHP here either. Even comparing at the correct level; PHP is still faster, but lets make sure we are making the right comparisons.

Re:Taking PHP Seriously by nrser on Friday October 14, 2016 @04:26PM (#12710838)
i am the original poster.

i was clarifying the compassion.

Re:Taking PHP Seriously by brightball on Friday October 14, 2016 @09:19AM (#12707849)
Very true. It's basically an interface to a C framework.
Re:Taking PHP Seriously by nrser on Friday October 14, 2016 @07:53AM (#12707493)
as the other commenter said, php is a web framework... and it's what we were using. it's actually more of a web framework than a language in my opinion (or at least was at that point). it's centered around receiving http requests and writing http responses. the article mentions this in fact.

it was a huge pain to try and get php to do anything else. it was totally unpractical to do the kinds of back end processing that we needed (since the database was pretty much off limits during a http request)... long running processes with hundreds of millions of objects were a no-go. believe me, we tried. which meant you had to sync all your logic into Java or something else that could handle the job. which is really error prone when you have a bunch of people moving fast on something.

one of the greatest things about php is that it's a super minimal focused framework. it's also one of it's major short-comings when that model no longer suffices.

you can layer something else on top of it, but the stuff available at the time certainly didn't help the performance or memory characteristics.

Re:Taking PHP Seriously by jliptzin on Friday October 14, 2016 @12:12PM (#12709045)
I think I sat next to you at zynga back in 2008 and remember your php struggles vividly.
Re:Taking PHP Seriously by nrser on Friday October 14, 2016 @04:30PM (#12710870)
hey Josh!
Re:Taking PHP Seriously by justinhj on Friday October 14, 2016 @02:36PM (#12710191)
I feel your pain, I also worked on a large MMO style mobile game backend, but my situation was a lot better because as you say AWS is a lot more mature at this point.

Dealing with limited resources such as MySQL and Redis is a problem you still have to fix when you move away from PHP though.

As for the Facebook runtime, for us it was a case of drop in HHVM, fix a handful of issues and get a 4x or 6x speed increase for free. You only need to change the way you write if you move to Hack, but I think I agree with you that's probably getting to the limit of the effort reward tradeoff before you rewrite in a different language.

Re:Taking PHP Seriously by niutech on Tuesday October 18, 2016 @02:02PM (#12737059)
Why didn't you choose Python/Django instead of PHP then?
Re:Taking PHP Seriously by guitarbill on Friday October 14, 2016 @05:06AM (#12706891)
Developers care about cognitive load, and people care about security.

Sure, they'll be some guy who's memorised all of PHPs quirks, but for most of us the inconsistencies make it hell to program, because you're always looking up stuff. As a result, writing secure PHP is possible, but far harder than it should be.

IMO the laughable security track record of e.g. Wordpress have damaged PHP's reputation more than anything else.

Re:Taking PHP Seriously by dsacco on Friday October 14, 2016 @09:16AM (#12707831)
As a counterpoint, Facebook, one of the most secure companies in the world, is also the largest single PHP deployment in the world.

C is also a language with a frankly horrific security track record; at least an order of magnitude more so than PHP. But C continues to be used because it is a useful and relatively simple language despite its warts and pitfalls.[1]

Security is just as much a business process as it is a technical feature.

______________________

1. Granted, one of the major design goals of Rust is replacing C, but you get the point.

Re:Taking PHP Seriously by guitarbill on Friday October 14, 2016 @11:26AM (#12708696)
Or Etsy.

I think your comment about C is right, however in many cases mercifully the C code isn't facing the internet :) When it does, it can go very wrong, e.g. OpenSSL.

The extra cognitive load doesn't guarantee failure, it just makes it easier to slip up. Even with Python or Rust, you can put insecure code in there (e.g. with Python's subprocess.call(..., shell=True)). Realistically, strict modes and linters are always a good idea and can catch most of these pitfalls.

Re:Taking PHP Seriously by jagger27 on Saturday October 15, 2016 @01:50AM (#12712914)
Of course C is facing the internet. The entire Linux networking stack is written in C. Damn near every request on the internet touches that code.
Re:Taking PHP Seriously by guitarbill on Saturday October 15, 2016 @07:23AM (#12713568)
At which point did you decide not to read the comments properly?

The gist was that PHP was designed for web use, so it's almost always facing the internet. C on the other hand is very much multi-purpose. Both can be made secure, but maybe it's less effort using something that helps you with security (Hack, Rust, etc.).

(BTW, your comment contains a huge fallacy: Just because a majority of packets touches something written in C, that doesn't mean a majority of C code written is exposed to the internet. This is arguably the entire point of e.g. iptables.)

Re:Taking PHP Seriously by sebcat on Saturday October 15, 2016 @03:27AM (#12713104)
And nginx, and apache, and php, and ...
Re:Taking PHP Seriously by michaelmrose on Friday October 14, 2016 @12:12AM (#12706097)
Doesn't it stand to reason that the people that actually know how things work under the hood are the people that care about such things.

You could say the same thing about cars people don't care about what sort of engine is under the hood or how it works they just want to go places! It doesn't then follow that all cars are the same and you are just as well getting any one of the millions of cars or even any one of the models out there.

Re:Taking PHP Seriously by increment_i on Friday October 14, 2016 @12:29AM (#12706143)
You have a logical point for sure. I think it might be an apples to oranges comparison in this case though. I just don't know that building cars is the same as building websites and apps. I know Php and JavaScript can respond to an HTTP request. I don't know how to optimize an internal combustion engine. There's probably parallels in terms of expertise with software developers, but I can't be sure.
Re:Taking PHP Seriously by pif on Friday October 14, 2016 @06:52AM (#12707245)
> I just don't know that building cars is the same as building websites and apps.

Indeed it isn't. "Maintenance" has opposite meanings in those worlds: maintaining a car means keeping its original functionalities still available; maintaining an application means letting it evolve.

Re:Taking PHP Seriously by pif on Friday October 14, 2016 @07:01AM (#12707277)
> Only engineers care about programming languages. Seriously. That's it. No one else cares about them.

So what? Who else could care for something apart from those professionals using it?

Maintenance is the biggest part of software development. A wrong technological choice can turn my nice job into my worst nightmare. Why shouldn't I care?

Re:Taking PHP Seriously by cloverich on Friday October 14, 2016 @10:58AM (#12708482)
> So what?

I think the intention is: While they are important to us, languages are frequently distorted to the point that we believe that company success as a whole is dependent on it. Companies like Facebook flatly contradict that. I agree with you in spirit: Facebook would obviously prefer not PHP. But if the choice is: Learn something other than PHP or use language I know to test some idea, I think the latter is an obvious choice.

Re:Taking PHP Seriously by evilduck on Friday October 14, 2016 @12:27PM (#12709158)
Runaway successes like FB are outliers. Failed businesses OTOH are quite common and usually have a number of causes where bad technology choices can be at least a factor.

You call it poor management in retrospect, but it's succeeding in spite of the tools when you're still doing ok. There's a lot of companies that exist in between failure and "Facebook" who don't have hockey stick growth curves who also can't afford needlessly higher technology costs, whether that's in infrastructure or staffing or opportunity costs in getting features to market. If PHP does't incur a higher cost personally, go for it, but it might be a strategic disadvantage later if you don't hit it big.

Re:Taking PHP Seriously by continuational on Friday October 14, 2016 @11:09AM (#12708562)
Only farmers care about tractors.

That's not a reason to use horses instead.

Re:Taking PHP Seriously by vancouverwill on Monday October 17, 2016 @07:33AM (#12724120)
exactly.
Re:Taking PHP Seriously by pmoriarty on Saturday October 15, 2016 @04:36AM (#12713246)
"Only engineers care about programming languages."

It's sadly quite common for non-engineers to make technical decisions such as what language, tool, or hardware will be used, and everyone else just has to live with it.

Re:Taking PHP Seriously by __s on Friday October 14, 2016 @08:20AM (#12707586)
I work at a company that use to do PHP, but now only does asp.net for web projects. We dread having to maintain our legacy PHP code
Re:Taking PHP Seriously by trevelyan on Friday October 14, 2016 @01:09AM (#12706238)
Brian, do you have any examples of companies that failed using PHP that you think would have succeeded with another interpreted language, and what problems did they run into that gave you this judgment?

Asking as I've developed in a slew of languages and never found the PHP-bashing credible. Most of the complaints seem to come from Rails people, but there are no shortage of MVC frameworks in PHP, including at least one that is a direct clone of Rails.

Re:Taking PHP Seriously by gdudeman on Friday October 14, 2016 @10:43AM (#12708373)
I to have seen plenty of companies flail and get bogged down because of technical debt and a just get it done culture. It's really hard to begin with a "yes it's a mess, but it works" culture and transition to anything else.

Plenty of A rounds have been spent trying to make a sand castle taller.

This is not unique to php - I'm sure you can do it right - but it's more common to it.

Re:Taking PHP Seriously by flukus on Friday October 14, 2016 @01:14AM (#12706247)
I've seen plenty of companies fail (or at least stall) because of technical debt. PHP certainly isn't to blame for that but it doesn't exactly lead by example either.
Re:Taking PHP Seriously by paulriddle on Friday October 14, 2016 @11:18AM (#12708646)
I think it would be hard to provide such an example. Mostly because most companies that fail don't do it because of technology but rather because of the nature of their product itself, people, or money. And language plays a part in it but not a particularly noticeable one. Another reason is that failures tend to be silent and we don't pay attention to silent things.
Re:Taking PHP Seriously by chiefalchemist on Thursday October 13, 2016 @07:48PM (#12705155)
True. But they might have failed with any other choice. Technology is overrated. Yeah, it matters, Yeah it helps. But the right foundation won't save a shite product.
Re:Taking PHP Seriously by pavel_lishin on Thursday October 13, 2016 @09:29PM (#12705587)
But the wrong foundation can tank a good one.
Re:Taking PHP Seriously by apocalyptic0n3 on Thursday October 13, 2016 @11:34PM (#12705979)
That's true of all languages, though.

A truly good idea will generally find a way to succeed despite the technology it is built on, though. Look at Facebook, Slack, and countless others running PHP or Minecraft running Java and its apparently horrible code base (I've never seen it, so that is secondhand)

Re:Taking PHP Seriously by michaelmrose on Friday October 14, 2016 @12:21AM (#12706125)
A number of things actually follow more logically than tech doesn't matter which is counter intuitive and counter to most other endeavors in life.

- We aren't very good at judging the relative virtues of tech

- Most tech is good enough to express most concepts even if not equally well. If its possible to express it even if it takes 3 times as much work and is only 70% as good you wont notice from the outside how much the tech mattered.

- Good ideas are worth enough money to throw enough time/money at them to be moderately successful

Re:Taking PHP Seriously by jwatte on Friday October 14, 2016 @12:42AM (#12706180)
Delivering enough value to users, faster and cheaper than the competition, wins.

The language you use pay second- and third order dividends, but most battles are fought and won on first order.

I'm a C++ developer, have shipped Java and C# and Haskell and Python and a bunch of other code in production. If a friend asks me to spin up a website for him/her quickly, I'd still do it in PHP.

Horses for courses.

Re:Taking PHP Seriously by eyelidlessness on Friday October 14, 2016 @01:36AM (#12706313)
What does PHP offer, now, that a static site generator doesn't? I'm going to guess Wordpress, WYSIWYG editor, simple uploads. But if that's not it, I'm genuinely curious.
Re:Taking PHP Seriously by bbcbasic on Friday October 14, 2016 @02:23AM (#12706428)
Dynamic content.
Re:Taking PHP Seriously by apotheon on Friday October 14, 2016 @09:48AM (#12708021)
For many use cases, this is not relevant to the end result.

For many use cases where it is relevant, static site generators like Jekyll can actually imitate "dynamic content" from the perspective of the people running the site.

The most important use cases for dynamic content these days are web applications, as distinct from "websites". On the other hand, web applications are also the most important use cases for better development ecosystems than are easily attained with PHP.

In my experience and observations, the cases where PHP's easy provision of dynamic content capabilities make the most difference are websites (as distinct from "web applications") on shared hosting platforms or bootstrapped by existing content management systems like WordPress and Drupal (which are, in turn, often easily used because of either hosting platforms specifically for those CMSes or shared hosting providers).

NOTE: I'm not sneering at "websites", as distinct from "web applications", as many people who draw such distinctions do. I'm just pointing out there is a distinction to be made between two different types of projects involving deployment of a codebase to a web server. Speaking only of the technology's proximate purpose: in one of these, the primary purpose of it is to make content accessible to the public; in the other, the primary purpose is to make functionality accessible to a userbase.

Re:Taking PHP Seriously by vatotemking on Friday October 14, 2016 @03:57AM (#12706677)
Underrated comment.

To expand on this, static website generators are best for generating documentation and small blogs. It falls apart when you have a large often-changing content. This is where PHP is still king of the web.

Re:Taking PHP Seriously by foolinaround on Friday October 14, 2016 @02:59PM (#12710320)
> It falls apart when you have a large often-changing content.

Today, when one can have workflows via jekyll/git/Continuous deployment, at what frequency of "often-changing" should one move away from static websites to a php based solution?

Re:Taking PHP Seriously by vatotemking on Friday October 14, 2016 @07:34PM (#12711836)
I haven't tried jekyll so I can't really comment on it. Im guessing it only generates the changed files everytime you push to git, no? As for your question, it depends on other factors too. Who are your users, what is your web app, is it an ecommerce site? Is the jekyll/git/CI workflow easier than just pressing a few buttons on the screen everyday? Those are the questions you should ask. jekyll might be obvious for us devs but we are a minority compared to the rest of the population.
Re:Taking PHP Seriously by bbcbasic on Saturday October 15, 2016 @01:45AM (#12712909)
Take HN as an example. This can't be done as a static site.

Or a simple guestbook or hit counter.

Where the lines may blur is JS front end talking to a BaaS... This may make it possible to glue up impressive sites using just HTML and JS with no custom backend requirement.

Re:Taking PHP Seriously by guitarbill on Friday October 14, 2016 @05:21AM (#12706946)
> large often-changing content. This is where PHP is still king of the web.

PHP is still widely used, but there's a myriad of other contenders: Java, ASP.NET, Python (Django,Flask,etc), Ruby (Rails), Perl, Javascript (Node,etc) and others.

I'm not sure about PHP being the "king". PHP might be the most widely deployed thanks to either FB or the huge number of legacy bulletin boards and wordpress sites, but in terms of new deployments does it still dominate? Probably not. (For novices, a static site generator is definitely the way to go, until you run into it's limitations.)

Re:Taking PHP Seriously by nucleardog on Saturday October 15, 2016 @07:14PM (#12716052)
All of the languages you listed have a way steeper learning curve than PHP. PHP creates a lot of really small steps you can take getting from "I roughly understand HTML" to "I can build a full 3-tier MVC buzzword-of-the-day app.". For anyone not intending to become a full-fledged programmer, but instead just to add a little bit of interactivity/dynamism to their website, it's still the path of least resistance.
Re:Taking PHP Seriously by guitarbill on Sunday October 16, 2016 @03:26PM (#12720455)
I'd argue that Javascript (sans all the frameworks and bullshit) will also get you there quicker, because of the intrinsic DOM connection. But yes, backend JS sucks.

I also made a start with PHP. Still, PHP has been slow to learn from other languages and frustratingly refused to change established behaviour. I found PHP to be far more "dangerous" for the amateur programmer than other languages. Finally, I switched and never looked back.

From teaching beginners, I actually think Python + Flask has a similarly shallow learning curve, but more room to grow and to "do it correctly" (e.g. the templating is much cleaner and the routing much more powerful). I recommend it.

Re:Taking PHP Seriously by spronkey on Monday October 17, 2016 @05:23AM (#12723620)
echo "<h1>hello</h1>" vs... damn, how do you even print a line in Javascript (Node, to be fair)? console.log()? Wait no, that prints to a terminal. Response.write? Oh, wait, I have to implement the http.createServer callback? Yeah ok, oh and it's ... response.print? No, no it's response.write. Oh what it's not working? Oh I need response.end() as well.

Hopefully you get the point.

(I do agree that PHP without something like Symfony, Yii, ... Laravel, even Cake could be very dangerous, or at least, counter-productive for amateurs trying to learn though)

Re:Taking PHP Seriously by vatotemking on Friday October 14, 2016 @07:24AM (#12707371)
Youre right. I think JS has taken over the title, for better or for worse. Even WordPress is migrating to JS with its front end.
Re:Taking PHP Seriously by jamroom on Thursday October 13, 2016 @06:14PM (#12704539)
I've gone one step further and created a template:

Some companies are succeeding in spite of [insert language]. There are many, many users of [insert language], and we'd expect that there would be considerable variance, with some users doing awful (no traction, buggy sites, etc) and some hitting home runs (facebook). Because it's such a popular language, it will have users across this entire spectrum.

It's easy to cherry-pick the winners and miss all of the tremendous losers who picked [insert language] and got nothing for it.

Re:Taking PHP Seriously by pcwalton on Thursday October 13, 2016 @06:33PM (#12704701)
I know you're making a parody, but I think I agree with your parody.

I mean, essentially all you're saying is "startup success is largely uncorrelated with the programming language used to implement those startups' products". That seems like not at all an unreasonable position.

(It's not, by the way, equivalent to the statement "choice of language doesn't matter".)

Re:Taking PHP Seriously by qwertyuiop924 on Thursday October 13, 2016 @07:51PM (#12705171)
Ooh.

Mind, I agree with you, but given the Holy Documents Handed Down By Our Lord and Savior, Paul Graham, HN... might not be the safest place to say it.

Edit: so, I'm clearly getting a lot of downs on this... maybe sarcasm in reference to PG was going a bit too far. Oh well. I'm not deleting or editing any of it, because that's sort of dishonest.

Re:Taking PHP Seriously by jamez1 on Friday October 14, 2016 @12:08AM (#12706080)
Sarcasm in general pisses people off, doubt it's anything Paul graham specific
Re:Taking PHP Seriously by eyelidlessness on Friday October 14, 2016 @01:34AM (#12706304)
Sarcasm pisses people off, or delights them. Or both.
Re:Taking PHP Seriously by chiefalchemist on Thursday October 13, 2016 @07:51PM (#12705166)
Luck. Timing. Culture. Team. Etc. All have a greater impact than language. Anyone who says otherwise doesn't understand history.
Re:Taking PHP Seriously by 4ndrewl on Friday October 14, 2016 @03:48AM (#12706653)
This needs to be said more.
Re:Taking PHP Seriously by dyjakan on Friday October 14, 2016 @04:38AM (#12706802)
Culture is correlated with technology, i.e. certain technologies appeal to certain kinds of people.

You can go to any Ruby meetup and you will see it's different than PHP meetup which both are quite different from Functional Programming meetups.

Thus I would say that it's not about the technology but about people whom you attract (i.e. culture).

I skip luck & timing, these are mostly random and one has very little power to influence them.

Re:Taking PHP Seriously by spronkey on Monday October 17, 2016 @05:27AM (#12723638)
All three of the above communities (PHP, Ruby, and FnProg) are diverse enough that a PHP meetup in location A could be culturally similar to an FnProg meetup in location B, and so on.
Re:Taking PHP Seriously by vancouverwill on Monday October 17, 2016 @07:37AM (#12724137)
you could definitely argue that a company using PHP nowadays would find it harder to find good engineers because the best ones who care about quality, performance etc don't want to work on a PHP app
Re:Taking PHP Seriously by edoceo on Thursday October 13, 2016 @09:44PM (#12705634)
Traction and Team. Luck is not a factor.
Re:Taking PHP Seriously by chii on Thursday October 13, 2016 @11:22PM (#12705946)
why is luck not a factor? I'd imagine it's the biggest factor that you can't control!
Re:Taking PHP Seriously by collyw on Friday October 14, 2016 @03:08AM (#12706533)
I completely agree with this. There were a host of similar services when Facebook appeared in my radar, I was signed up to a couple of them. Its only because more friends signed up for facebook that it seemed to have a snowballing effect. It didn't seem in any way superior (well except compared to myspace).
Re:Taking PHP Seriously by Gruselbauer on Friday October 14, 2016 @04:13AM (#12706729)
In Germany, we used to have a VK-like social network aimed exclusively at university students that was big before Facebook even appeared. To this day I have no idea how that died so fast and hard, and how Facebook managed to overtake it when it hadn't even translated the interface. Ze English izn't zecond nature to all ze Germans.
Re:Taking PHP Seriously by guitarbill on Friday October 14, 2016 @04:59AM (#12706879)
Ah yes, the * VZs. From my perspective, there's a few reasons. One, my friends were very privacy conscious and would often either not sign up or use a weird name (like some people do). This made it hard to find people. Two, the user experience sucked hard. Third, they had different domains for different subgroups (I remember one for school children and one for students).

Finally, if you went travelling to any other country (except Austria or Switzerland maybe), the rest of the world had Facebook. So to keep in touch, you also needed Facebook, which had a better user experience. Why bother with both?

Re:Taking PHP Seriously by apotheon on Friday October 14, 2016 @09:39AM (#12707959)
It's a testament to the poor state of the art in user experience for early social networking sites that Facebook had a (relatively) "good" user experience. It has always been horrible, except relative to most of its competitors.
Re:Taking PHP Seriously by edoceo on Friday October 14, 2016 @03:36PM (#12710520)
So, not luck. Despite all the down votes
Re:Taking PHP Seriously by chc on Thursday October 13, 2016 @06:21PM (#12704594)
Your template is far less interesting than the original statement. PHP spent a pretty long time as basically the lingua franca outside the enterprise world (and even some places in it), and there are still domains where it holds that title (e.g. WordPress alone outweighs many languages' ecosystems), so the phenomenon the parent was describing applies more to PHP than to some arbitrary language you could insert into this template.
Re:Taking PHP Seriously by jamroom on Thursday October 13, 2016 @06:32PM (#12704689)
I actually agree with the original statement. PHP, for quite a few years now certainly has NOT been the language of choice for most startups, yet we still see the majority of them fail.

"and miss all of the tremendous losers who picked php and got nothing for it"

certainly applies equally across all languages in my opinion.

Re:Taking PHP Seriously by chc on Thursday October 13, 2016 @06:58PM (#12704860)
That's not what was being discussed, though.

The grandparent of your comment suggested that, yes, these projects were lifted up by PHP's un-fancy nature giving them focus. The parent of your comment was suggesting that, basically, the companies that have succeeded using PHP aren't any more numerous than we would expect to have come out of the massive PHP userbase even if PHP doesn't offer any advantages at all.

The observation that "PHP, for quite a few years now certainly has NOT been the language of choice for most startups, yet we still see the majority of them fail" seems to be responding to a nonexistent conversation in which people were positing that startups based on other languages don't fail. Nobody here is saying that other languages magically make your business succeed.

Re:Taking PHP Seriously by wyager on Thursday October 13, 2016 @06:04PM (#12704453)
Precisely. This is classic base rate fallacy. If tons of people use PHP because PHP devs are cheap, there are bound to be a ton of successes despite the fact that it's a horrible technology in many respects.
Re:Taking PHP Seriously by chris_wot on Thursday October 13, 2016 @06:19PM (#12704578)
Perhaps. But that rather begs the question. PHP has horrible bits, but in fact from what I've observed in the last year or so is that whilst it has in the past been fairly horrible, much of what made it awful can be entirely avoided.

If you aren't following the PHP Framework Interop Group (http://www.php-fig.org) then you really should. I'd hazard that most of the warts in PHP can now be avoided pretty much altogether, and those that can't quite possibly can be worked around through configuration.

Re:Taking PHP Seriously by brian-armstrong on Thursday October 13, 2016 @06:26PM (#12704632)
An easier way to avoid those warts would be to pick a different language
Re:Taking PHP Seriously by anexprogrammer on Thursday October 13, 2016 @07:38PM (#12705101)
PHP devs aren't expensive. Even good ones.

It's easier to reroll in another language and retrain or recruit? No. So you probably mean for a new project. So now you've more maintenance and learning curve unless you just happen to have enough skilled in $NEWTHING. Not really easier.

PHP is an inconsistent mess, everyone knows that, but it's cheap, widely understood, and it's perfectly possible to write decent maintainable code. There's ways to mitigate the chaos.

Re:Taking PHP Seriously by collyw on Friday October 14, 2016 @03:13AM (#12706548)
True, I have seen one startup fail early because he couldn't find any (cheap) Django devs. He might have stayed around another year with the funding he had if he had gone PHP.
Re:Taking PHP Seriously by apotheon on Friday October 14, 2016 @09:52AM (#12708047)
Lesson Learned: If you can't do it yourself, start with PHP (or something else with incredibly cheap devs, I suppose) until you get VC funding, then rewrite it using something other than PHP.
Re:Taking PHP Seriously by sidlls on Friday October 14, 2016 @01:42PM (#12709777)
Django devs are cheap, too.
Re:Taking PHP Seriously by foolinaround on Friday October 14, 2016 @03:01PM (#12710329)
> PHP devs aren't expensive. Even good ones.

Would'nt the good ones logically move to a different language ( JS/Ruby etc ) where they could bill more?

Re:Taking PHP Seriously by sethrin on Saturday October 15, 2016 @09:20PM (#12716368)
Money past a certain point is not an incentive. Retraining takes time. It's harder to land jobs for which one does not have relevant work experience. The PHP job market is larger than most other web programming segments, so work is easier to find. But sure, if you're hiring, I'd certainly prefer working with Ruby.
Re:Taking PHP Seriously by ux-app on Thursday October 13, 2016 @06:45PM (#12704774)
and miss out on all the awesome aspects of the language/environment?
Re:Taking PHP Seriously by NMDaniel on Thursday October 13, 2016 @08:02PM (#12705232)
There are plenty of great server-side languages and environments. C#,Java,Scala,Python,Ruby,Haskell.

If this was about JavaScript and Front-End I might've agreed with you (there are transpilers but interoperability with JS modules can be tricky), however in the realm of servers there's so much freedom.. so why choose PHP out of them all?

Re:Taking PHP Seriously by mastazi on Thursday October 13, 2016 @11:36PM (#12705981)
> plenty of great server-side languages and environments

Depending on the type of project, I would choose PHP over at least some of the languages you mentioned; I guess "great" is not a significant quality when making architectural choices.

Just to be clear: I was thinking about factors like performance, choice of servers, how easy it is to hire good developers, library ecosystem etc.

EDIT: obviously the "awesome aspects" mentioned by GP are a similarly unsubstantiated claim ;-)

Re:Taking PHP Seriously by raarts on Friday October 14, 2016 @10:18AM (#12708210)
C#: windows or mono-on-linux

Java: keyboard wear

Scala: not enough programmers

Python: not bad

Ruby: too slow

Haskell: math grad required

Re:Taking PHP Seriously by NHern031 on Friday October 14, 2016 @12:32PM (#12709191)
The .NET CORE is now open source and cross platform. Cross platform compatibility with the exact same source code, and the killer features/speed of C# makes its my personal choice for a server-side language. I would like to add that C# devs are not cheap and also seem to be slightly more limited in today's market compared to PHP devs.
Re:Taking PHP Seriously by sjellis on Saturday October 15, 2016 @12:54PM (#12714671)
If you are running .NET code in production on a non-Windows platform today, then you and your team are probably braver and more willing to work around issues than most. I hope that running .NET code on Linux becomes the common case, but I suspect that we are still a couple of years away from that.
Re:Taking PHP Seriously by ZenoArrow on Saturday October 15, 2016 @02:42PM (#12715144)
It might not be exactly what you had in mind as 'in production', but it's probably worth noting that Unity uses Mono as a core component, and it seems to be fairly popular on non-Windows platforms.

https://github.com/Unity-Technologies

Re:Taking PHP Seriously by brianmurphy on Friday October 14, 2016 @06:36AM (#12707191)
If you are building software that will be deployed by a large number of users, having PHP provided by every $3.99 & up hosting company can't be underestimated. Languages like Haskell are nonstarters.
Re:Taking PHP Seriously by peteretep on Thursday October 13, 2016 @07:17PM (#12704995)
What are "all the awesome aspects"? The being embedded in the web server and the benefits that brings I understand. The rest?
Re:Taking PHP Seriously by justinhj on Friday October 14, 2016 @01:34AM (#12706307)
Disclaimer I worked on a large php app server that ran on about 50 servers and I miss it.

The documentation is really good. A model for programming language documentation.

Process per request is really simple to understand and scale. Your servers almost never crash completely, you don't get threads silently dying or run out of memory or thrash the CPU doing garbage collection.

It runs like a tank. It will, for better or worse, just keep running when more fussy languages would have seg faulted or shut down

The tooling, framework and libraries are very advanced and in active development

It's easy to train a programmer in php

It's close to the c library

The combination of a very flexible array/map and functional programming tools like map and reduce let you write pretty declarative code and development can be very fast

Php storm

Facebooks replacement runtime

I work with Java and Scala now which I also love but development is much slower and more expensive, whilst deployment is cheaper (less hardware for same request throughout)

Re:Taking PHP Seriously by apotheon on Friday October 14, 2016 @09:58AM (#12708079)
Can you describe for me how the tooling, framework(s), and libraries are so advanced and excellent?

How easy is it to train a programmer to use PHP in a way that results in fairly secure, reliable, bug-free code? (Note my use of the word "fairly", knowing that there's no such thing as perfect security, reliability, or freedom from bugs.)

I do know that, for instance, TDD is possible with PHP. In my experience and observation, though, the available developer tooling does not even come close to that of (for instance) Ruby, so I figure I must be missing something if "the tooling, framwork[s,] and libraries" constitute a major advantage to PHP over other options.

Re:Taking PHP Seriously by justinhj on Friday October 14, 2016 @11:35AM (#12708764)
Good questions.

Well firstly phpstorm is a very high quality. I can work with php code in various contexts such as running test suites, normal development and connecting to a live server. It definitely has good support for running and debugging test suites including unit, integration and functional. There is support for vagrant and docker as well.

The tooling is good because there are lot of users willing to pay for good tooling, but at the same time it can only exist if the underlying language supports the features needed.

I wouldn't say the libraries and tools give it a significant advantage over other languages actually, but it's a notable factor of php development that there is likely a framework and library for your needs.

Regarding training, once we had a reliable application and we'd figured out as a team some best practises regarding avoiding php's bad parts, how to avoid or detect and handle runtime errors and how to organize and layout code, it's a fairly simple matter to point a new programmer at these documents and code samples.

There's really not much to the language and a smart and/or experienced programmer can be productive in days. I'm not sure that's the case if you move someone from say c to Python or from Ruby to Scala.

Re:Taking PHP Seriously by spronkey on Monday October 17, 2016 @06:08AM (#12723790)
PHP is about 1/3rd of my day job. Java 1/3rd, and support languages for ops (mainly Python and shell scripting) 1/3rd. Find myself commenting a lot on PHP threads in the last few days...

In my earlier days I did quite a bit of developer tutoring, and I have trained developers in PHP codebases on quite a few occasions, so I can speak to the training aspect first hand. I actually find PHP is fine to train developers in - certainly to produce simple code that is reasonably bug free, if not particularly high performance. The 'everyday' use of the language is usually quite straightforward - most projects don't deal with concurrency primitives, long running code, or low level interop. Scoping is quite straightforward. The only real gotchas are type coersion (use === for primitives or write comparator functions) and superglobals (use a library).

To be honest, JavaScript causes just as much confusion in my experience with scoping. Heck, a scarily high number of developers I know would struggle to implement a bug-free equals() method in Java.

As for tooling - here are some examples of good tooling in PHP:

- Dependency management - Composer and it's centralised library, Packagist (npm/rubygems/maven analogue)

- TDD and testing: - PHPUnit (ubiquitous, fairly well featured - built in fakes, code coverage) - Behat (BDD-style testing a la Cucumber) - Codeception (DSL-based) - All three tools have decent integrations with IDEs, can be run easily through Composer's CLI, can be combined with stuff like Grunt/gulp easily for file watchers. - I haven't needed the really esoteric features in my Ruby projects so I'm probably not the best to judge, but I can't say that I find PHP testing tools all that lacking compared to rspec, cucumber etc. I don't feel like you need complex tools for good testing... - Frameworks such as Laravel provide bootstrapping on top of e.g. PHPUnit that provide integration test componentry

- PHPDoc - ubiquitous, well documented, well supported by IDEs, linters, docgens

- PhpStorm (on par with the best IDEs out there), Zend Studio (very good IDE in its own right, eclipse-based), and Eclipse PDT are definitely servicable IDEs with good integration, good code inspections, good support for refactoring (especially now with PHP7 and it's further push into gradual typing).

- PDO - something most other languages have to be fair, but a language-supported SQL database engine abstraction layer is a must for working with SQL databases these days

- Gearman for task queues

Libraries and frameworks available in PHP are much the same as other languages in my experience, when it comes to stuff for the web. Not really much point going through them, suffice to say that there are some poor choices (Wordpress), and some good choices (Flysystem).

Re:Taking PHP Seriously by premium-concern on Friday October 14, 2016 @04:46AM (#12706831)
I stopped taking this seriously after "the documentation is really good".

Not sure whether this is your real opinion or you are just making fun of people who say that.

Re:Taking PHP Seriously by justinhj on Friday October 14, 2016 @11:53AM (#12708909)
We can't argue objectively about an opinion but take a look at this typical page of the php.net documentation:

http://php.net/manual/en/function.usort.php

It has everything I need to know about the function clearly laid out. The behaviour of sort when elements are the same. A list at the side of related functions that I may want to look at instead.

I also like documentation that includes user contributions as these often add useful caveats and usage examples that don't fit well in the general documentation.

Re:Taking PHP Seriously by babyrainbow on Friday October 14, 2016 @03:37PM (#12710527)
Php documentation is the worst. Some of the reasons..

1. They have exactly one set of documentation pages for all the php versions.

2. Another thing is that documentation can be quite wrong for even the fundamental stuff. I have seen a core developer blast out in reddit that "The documentation is wrong!", when the other party pointed them towards a piece of documentation.

3. Incomplete or shallow description. Go check out the documentation page for Exceptions in php and try to find information regarding the behavior of return statements in a 'finally' block. Now go an see the respective page in Python documentation and see how in depth the documentation is.

And having code samples is not exclusive to Php's documentation..

Re:Taking PHP Seriously by wyager on Thursday October 13, 2016 @06:27PM (#12704643)
It's not just about the obvious "warts"; it's about the fact that PHP is not a well-designed language on the first place. A wart-free pig is still a pig.
Re:Taking PHP Seriously by Aldo_MX on Thursday October 13, 2016 @07:03PM (#12704894)
Which of the top languages is actually well designed? All of them have their area of opportunity.
Re:Taking PHP Seriously by wyager on Thursday October 13, 2016 @07:16PM (#12704986)
Rust and Haskell are both extremely well designed. Most of the "top languages" by percentage usage are 20+ years old, so I can't fault them that much for being badly designed, but we should definitely stop using them.
Re:Taking PHP Seriously by Aldo_MX on Thursday October 13, 2016 @08:15PM (#12705301)
> we should definitely stop using them

That will never happen, you can't write code like this in Rust:

  <!-- Snippet taken from an example of tightly-coupled and unmaintainable code in the Clean Architecture in PHP book[1] -->
  <body>
    <?php $results = mysql_query('SELECT * FROM customers ORDER BY name'); ?>
    <h2>Customers</h2>
    <ul>
      <?php while ($customer = mysql_fetch_assoc($results)): ?>
      <li><?= $customer['name'] ?></li>
      <?php endwhile; ?>
    </ul>
  </body>
Even when the previous code is an abomination, it is absolutely easy to write, this is why languages like PHP are a success, the barrier to entry is definitely low.

The issue comes when the whole industry buys the idea that PHP equals bad code, fail to appreciate the progress the language has had in the last years, fail to appreciate the effort behind projects like Symfony, and become completely foreign to the current best practices.

[1] https://leanpub.com/cleanphp

Re:Taking PHP Seriously by tigershark on Friday October 14, 2016 @08:52AM (#12707718)
Why would I ever want to access the database from the presentation layer? That you cannot write that abomination in rust for me it is a clear advantage, not a disadvantage. And still I can't understand how can you compare php with rust. A much more apple to apple comparison would have been with WebSharper.
Re:Taking PHP Seriously by nucleardog on Saturday October 15, 2016 @07:07PM (#12716033)
Because when you're just some guy that wants an answer to the question "how do I get some things from a database into a web page", the answer that starts "Well first go set up a VPS..." and hits "There's this thing called MVC" somewhere in the middle is not something someone who just wants to put a list of things into a web page is going to listen to.

Then a month later that guy that pulled those couple things into a web page is going to go "Hey, maybe I could make a thing to manage those.". And he's going to learn more.

Then a month later he's going to have another bright idea.

And suddenly someone with no programming background is a PHP programmer, and he's putting together ugly but functional websites and everyone is looking and going "MAN PHP IS AN AWFUL LANGUAGE".

There's a huge contingent of people that are maybe moderately technically savvy but are not programmers and are not necessarily interested in deliberately becoming one. These are the people that end up setting up entire businesses in some Lovecraftian Excel sheet. PHP is a language with a learning curve (even for a non-programmer), not a learning cliff, and it makes it really easy for these people.

Re:Taking PHP Seriously by wyager on Thursday October 13, 2016 @08:33PM (#12705371)
I don't know if you can do that in Rust (I suspect you can with some effort), but you can certainly do it in Haskell (with slightly different syntax, of course) using a library like Blaze-HTML5.

Your argument is a bit spurious; you're right insofar as you can't write PHP in a language that's not PHP.

Re:Taking PHP Seriously by Aldo_MX on Thursday October 13, 2016 @09:02PM (#12705474)
> I suspect you can with some effort

That is my point. You require effort in an order of magnitude greater than with PHP in order to achieve the same result, which in the case of a beginner, is the difference between continuing their journey in programming or abandoning the ship.

You are failing to see the big picture and are taking for granted the plethora of initial setup you have to do to begin working with a language like Rust (ex. generating bindings for a database driver written in C if it doesn't exist in cargo), you were just nitpicking in the syntax of the previous example (which BTW, I took care to clarify it was an example of bad code to avoid people not familiar with PHP from getting the wrong idea).

It was my fault to say "you can't" in my previous message (see Atwood's Law), I really meant "it requires too much effort".

Re:Taking PHP Seriously by babyrainbow on Friday October 14, 2016 @03:50PM (#12710608)
>You require effort in an order of magnitude greater than with PHP in order to achieve the same result..

An order of magnitude? Really? I don't think so.

Rust has a library (probably among others) called Horrorshow[1], that exports macros to do html templating.

You claim that it is easy in Php to do html templating. But you miss the fact that it provide zero sanity/security checks while doing so. You need to sanitize every one of those variables before inserting into the html stream.

You see, Php just trades off every bit of sanity and security for a little bit of ease of use. It is that simple.

[1] https://stebalien.github.io/horrorshow-rs/horrorshow/

Re:Taking PHP Seriously by Aldo_MX on Friday October 14, 2016 @05:57PM (#12711422)
Yes, an order of magnitude, in PHP we're talking about _minutes_ in Rust we're talking about _hours_ or even _days_ for a beginner programmer, ever tried to install Homebrew in a Mac to name an example? It adds at least a few hours to the equation with its dependency on Xcode unless you already know to just install the command line tools.

Remember that a beginner programmer doesn't always have a background in Computer Science, maybe it's a child, maybe a graphic designer, maybe an elder person or a housewife. Are you really expecting from a person foreign to CS to stop tinkering just because they can't write secure and performant code in your favorite language?

Again, stop taking for granted the initial process setup and all the gotchas that you already know, stop nitpicking in the example of templating and see the big picture: A beginner programmer being able to get instant feedback with little effort in their browser of choice. No initial project or repository set-up, no install for external libraries, no huge development environments (like Xcode or Visual Studio), no build process or compilation, no command line, just an app like WAMP (on Windows) or MAMP (which people accustomed to homebrew avoid) and a browser pointing to http://localhost.

PHP is not a perfect language, but it's neither the abomination people like you describe, too many people judge PHP by its former state of the art and are unaware of the progress it has had in the last years, many of the most popular issues are already gone or at least are too difficult to trigger, to name an example, PHP stopped having register_globals since version 5.4, and PHP 7 added strict type hinting, which throws an error instead of doing unexpected type coercions.

That doesn't mean that PHP is a better choice than properly-designed alternatives, just that it's less worse than before. I agree with the sentiment of using a well-designed language like Rust, but only when a project really requires that degree of security and performance (ex. writing a browser like Servo).

A bakery website written by the kid of a patissier doesn't require that degree of security and performance... Or are you really going to demand that child to use your favorite language just because you despise PHP?

Re:Taking PHP Seriously by babyrainbow on Friday October 14, 2016 @10:45PM (#12712503)
So, you are saying Php is like LEGO and BASIC for web development. I have got no problem with that. Problem is that people using that in a professional setting and uses it to put stuff online.

>A bakery website written by the kid of a patissier doesn't require that degree of security and performance...

I don't think so. Everything that is put online need to be secure. One day it is just a bakery website. Next day it is accepting credit card numbers. And the kid who did this can get employed as a php developer based on this experience, and might build stuff like that for years, with out a clue in the world that they are using a toy language.

Re:Taking PHP Seriously by wyager on Thursday October 13, 2016 @09:04PM (#12705490)
When I say "with some effort" I mean "with a bit of initial effort to create a combinator library and zero effort after that". I'm not familiar enough with Rust to be confident of that though. It's certainly the case with Haskell.
Re:Taking PHP Seriously by vatotemking on Friday October 14, 2016 @04:36AM (#12706792)
> I don't know if you can do that in Rust (I suspect you can with some effort)

You can, using some web framework crates, but PHP is many many years ahead from Rust in making web apps. And I'm not sure if its the right language for the web. You'd probably be fighting with the borrow checker and type system most of the time while the php dev is busy cranking out new features for his/her web app. There is also the problem of compiling huge websites.

Re:Taking PHP Seriously by brassic on Thursday October 13, 2016 @08:03PM (#12705242)
Haskell is also more than 20 years old.
Re:Taking PHP Seriously by wyager on Thursday October 13, 2016 @08:09PM (#12705272)
Which is why I fault PHP at least a little bit :)
Re:Taking PHP Seriously by codedokode on Thursday October 13, 2016 @07:36PM (#12705090)
Rust looks very complicated to me because there are "lifetimes" and you need to think where to put those single quotes properly. Not a language for a beginner.

Haskell doesn't support OOP if I remember correctly. And it is complicated too.

Re:Taking PHP Seriously by wyager on Thursday October 13, 2016 @08:02PM (#12705234)
I never said it was for a beginner, just that it was well designed. Lifetimes are no more complicated than stuff you regularly run into in C++, though.

Python is a great beginner-friendly language, but that doesn't mean it's well-designed in other respects or appropriate for large software projects.

It wouldn't really make sense for Haskell to "support OOP" in the usual since. The OOP paradigm is mostly useful when you have mutability. Another way of looking at it is that you don't need OOP in Haskell because it exposes better ways of interacting with data that aren't present in most OO languages, like ADTs and Typeclasses.

Re:Taking PHP Seriously by steveklabnik on Thursday October 13, 2016 @07:54PM (#12705183)
Due to lifetime elision, you rarely need to explicitly write lifetimes. I participated in the last Ludum Dare game competition, my game never used an explicit lifetime.

That said, it is true that Rust has tricky parts. The domain is inherently complex.

Re:Taking PHP Seriously by justinhj on Friday October 14, 2016 @01:36AM (#12706311)
Look at c++ as a counter example. Once immensely popular and yet I don't think many people would say it was well designed
Re:Taking PHP Seriously by test1235 on Friday October 14, 2016 @07:13AM (#12707320)
It is still ridiculously popular. It has it's place close to the metal, but a bit easier to use than regular old C.
Re:Taking PHP Seriously by chris_wot on Friday October 14, 2016 @08:42AM (#12707673)
Yeah, I'm sorry but I dispute it is easier to use than plain C.
Re:Taking PHP Seriously by igravious on Thursday October 13, 2016 @06:50PM (#12704807)
That's a bit harsh on pigs.
Re:Taking PHP Seriously by chiefalchemist on Thursday October 13, 2016 @07:53PM (#12705178)
Best comment so far.