3 ms·
Because the vast majority of PHP programmers began their programming journey by trying to post from a form built with static html, and worked their way down. In
by pessimizer 13y ago
Because the vast majority of PHP programmers began their programming journey by trying to post from a form built with static html, and worked their way down. In my experience (YMMV), they tend to lack the general programming concepts and practices that programmers who come from a CS/general computing (instead of web design) background are more likely to have, making it more difficult for the PHP programmer to move into another language.
I think the pervasiveness of modern, complex js techniques in recent years have been eroding that situation, because (especially with the gentle on-ramp of jQuery), PHP programmers are forced to become good js programmers too. Right now that means that a lot of the parochial attitudes of PHP programmers end up in the js community - and you see that in node.js, but ultimately it means that those programmers become familiar with two extremely different programming paradigms, and that will make a third language a lot easier to learn. When not trapped, they will leave.
I never understand the argument that PHP is an easy language (which this post doesn't suggest), though. PHP is hard because it is awful, and it's awful because it's hard. Consistency and lack of hidden state make things easier, at least for me. PHP is an easy language to put into production. Ruby is an awful language to put into production. I'm not even sure why the two get compared other than that Rails is supposed to be "easy" and PHP is supposed to be "easy."
A better feature to use to compare Ruby and PHP is that both of them fall to shit pretty immediately at load unless you are so good at enough layers of the entire stack that you're running on that any ease of learning or using PHP and Rails will make a minimal difference to you.
- swalkergibson 13y agoI have a bone to pick with your last contention. At what load does the PHP runtime begin to become the performance bottleneck, particularly with APC enabled? As far as I know, Facebook is about the only application with enough load to test the limits of the PHP interpreter itself. I was under the impression that PHP itself is actually quite performant...
- pjmlp 13y agoFacebook runs compiled/JITted PHP code.
- swalkergibson 13y agoRight, but they are only doing that because they serve so much traffic. The original post suggested performance "falls to shit pretty immediately at load." I cannot imagine they meant that you need to do some serious gymnastics to get around performance bottlenecks when you get to Facebook's scale. My supposition is that most web scripting languages would need tuning at that level.
- AdrianRossouw 13y agosee: drupal. having to execute the whole application from the entry point on every page hit is just awful. APC will only save you the loading from the disk and compiling part, not the whole execution chain. with node and others the application is just sitting there, listening to a port, and fires the right callbacks when a request comes in. the application startup cost is paid once. not on every request. there are people who have tried to reproduce it in php by having php running and serving multiple requests in a similar manner. This is really treacherous since php didn't even pretend to free memory under any circumstances ever, until about php 5.3. since moving over to writing servers, i just feel that the php model of executing the script when a url is hit is just fundamentally wrong.
- swalkergibson 13y agoDrupal lives in its own separate category somewhere near Mars. Just because Drupal is slow does not mean that PHP itself is the reason why. > APC will only save you the loading from the disk and compiling part Is that not the slowest part? According to the benchmarks here, http://www.techempower.com/benchmarks/#section=data-r7&hw=i7&test=json http://www.techempower.com/benchmarks/#section=data-r7&hw=i7..., PHP is only really slower than Node in serving up a plaintext response and a json serialization (although, it is only about a 5% difference in responses/sec between the two).