5 ms·
Most arguments against PHP miss the point. You know why you should use PHP? Because it's fun and you can get something running much quicker than figuring out th
by ammmir 5y ago
Most arguments against PHP miss the point. You know why you should use PHP? Because it's fun and you can get something running much quicker than figuring out the Elixir, Ruby, Rust, whatever ecosystem and paradigm. Maybe PHP is not so good at WebSockets or async worker threads, but most projects don't need that. There's no shame in doing long polling, users can't tell the difference anyway!
PHP shines when you're trying to get a server-rendered web app off the ground. It's the VB6 of the web. Nothing else matches its development velocity, from keyboard to working code.
- jbergens 5y agoI would guess nodejs has the same development velocity. And you can just copy js files into a server that has node to build a web application.
- spoiler 5y agoI used to believe this, but... But that's just not true. All the things you mentioned are a yum/apt/nix/pacman/ install away on Linux, and probably as simple to install on macOS. I'm sure Windows has installers for these, too. So, it's no harder to develop in them than it is in PHP. You could argue it's cheaper because you don't have to pay for a shared hosting provider to host your files. However that's a bit moot since even back in the day there were LAMP stack Vagrantfiles that would automate this local setup. Also, when speaking about dev velocity or time-to-start: you forgot JavaScript, which probably has much greater development velocity than anything else. Furthermore, PHP is rarely just PHP in production. PHP also comes with various runtime modes (CGI, FPM, etc), .htaccess rules (or nginx equivalents), a bunch of runtime language and feature toggles that are partially controlled by the system (ie your hosting provider), and some can be controlled by the application. The ephemeral process nature of the language makes some tasks very difficult to do in a performant way (but there's caching, so that's at least mitigated). I've seen so many developers (worked for a hosting company) come complain to us about slow servers when in fact they'd just be doing silly stuff. And it was hard to blame them, because the language encourages that model, and the "performant" was was usually orders of magnitude more difficult to implement (ie indexing, image resizing, or most types of batch processing). I'll not go into the horrors of how easy it is to mishandle file uploads in PHP (there's plenty of those around) and how many times people got easily hacked this way.
- spoiler 5y agoI went on a rant, but didn't mean to. I don't have anything against PHP, it's got a valuable and relevant place on the the web. It's important to many people, and like you said you find it fun, which I think is important for our productivity as devs. However, I think this recurring misconceptions how easy PHP is to develop in needs to stop. PHP comes with a lot of complexities. Worst kind of complexity to learn: hidden complexity.
- gregjor 5y agoOne person’s complexity is another person’s valuable job skill. PHP and Apache aren’t hard to setup and configure if you know how it works.
- spoiler 5y agoI completely agree that being able to navigate an ecosystem's complexity is a skill. I didn't mean to imply that other languages don't have complexities. All ecosystems come with their own boons and complexity issues (hidden or upfront). The thing I wanted to address is the general idea of "PHP is the simplest to develop in, it's just uploading a file" (paraphrasing) shouldn't be taken at face value, and that's why I pointed out some of the complexities when working with PHP that PHP developers tend to forget (or some ignore). But, because PHP is so easy to get started with, a lot of the complexity initially gets hidden away, and sometimes people learn about it the hard way. JavaScript used to be much the same, but it has gotten better in the recent years. Maybe PHP has gotten better in this aspect too, but I could be ignorant because I've not been keeping up with PHP as much
- gregjor 5y agoWith a hosting provider that already has PHP installed, you can simply upload a file to a folder and serve it over the web with no special expertise. PHP makes it easy for beginners and amateur programmers to get something working without knowing much. Because of the low-barrier to entry and simple hosting setup people have written a lot of crap PHP code over the years. I know, I see it and work with it. Amateurs and well-meaning power-users can get some web pages up and running easier with PHP than with almost anything else, so while inexperienced programmers can write bad code in any language a large number of them choose PHP. None of those facts mean PHP is not suitable for "real" development and "real" programmers. It is not obsolete or dying. A professional programmer who knows how to build production-quality web sites can get great results from PHP. That requires putting in the same time and effort needed to learn any other language and set of tools.
- makeitdouble 5y agoYou mention it in passing, how much ruby on rails experience have you ?
- herbst 5y agoUntil someone implements long polling in wordpress and has to load the whole framework for every poll. This can never be the right approach
- lessname 5y agoThere are other solutions to long polling now. You can use Pusher, ReactPHP or Amp (https://amphp.org/ https://amphp.org/) to use websockets with php instead.
- dapids 5y agoThat made me laugh, thanks.
- agumonkey 5y agoI've noticed some good bits in PHP, there's indeed a low level thing to it; it's not trying to find the new paradigm. Their cli tools are often nice and to the point (rare quality). But the language per se doesn't seem to bring a lot compared to python in terms of expressiveness, and the regular bugs are still worrisome to me.
- farresito 5y agoSurely you also have to figure out the PHP ecosystem and paradigm if you don't have experience in it? In any case, I fail to see how PHP is more fun than, say, Python. I have done a few projects in PHP and I would take Python in a heartbeat. To me this seems like a clear case of Stockholm syndrome, but what do I know... Maybe I'm missing something.