It's only hated by those who haven't grokked modern php > 7.0. Thanks to laravel the php ecosystem has grown quite a bit over the past few years. I know many rails devs who prefer laravel/php to rails for what it brings to the table. Sure ruby is prettier syntax, but php isn't as horrible as it used to be. Now if it could catch up on parallel/asynch it'd have a better time.
Sure there's sexier languages like elixir and go and rust, but well designed php code is a pleasure to work w/.
yeah, I'm working on one now (picking up where Indian devs left off) ...
Code is laravel 5.2, every controller injects session, requests, etc into the constructor, then injects a 'manager' which is basically a loose repository structure, laravel 5.3 > somewhere makes it so using requests/sessions in constructor you generally want to wrap that in middlware...
So upgrading is a huge nightmare. This is one reason I'm not a fan of repository pattern, more classes to inject everywhere even when they're not fully needed. When just making a fatter model would suffice.
Also lots of bad php practices...everywhere else. Bad devs can work on any code base, but laravel core code is pretty beautiful, and laravel's community encourages better code, if some bad actors write shitty code the rest of us have to clean up that's on them, but woocommerce is owned by Automattic and has bad code, you'd think they'd fix it or something being a large company.
There's also tons of great packages out there that are written way more OO and with testing and best practices than there are for wordpress. Laravel is also easier to optimize, and the data structure for wordpress can get out of hand as well.
ltdr; Yes, lots of bad laravel code -- but that's on the individual dev, core laravel and lots of laravel packages use php best practices and encourage good coding. Easier to write better code in laravel than it is a wordpress plugin.
We usually gain a better understanding of the world through numbers rather than booleans.
It's true that programmers hate PHP. It's true that programmers love PHP. It's true that programmers hate other languages. It's true that programmers love other languages.
This isn't very useful, as you seem to imply; but only due to the boolean perspective.
Numerically, PHP is hated far more than other languages, and loved far less (StackOverflow surveys come to mind, but I'm sure there's a whole lot more data on this)
The StackOverflow surveys only show you the data from the people who want to answer. It's always going to be skewed one way or another. I use and like PHP, and I rarely do the SO survey because I never see it in time.
I don't know... Ask me most days and I'll tell you how much I hate javascript and it's horrible ecosystem and incongruity...
but I can't live without using it as it's pretty much the only option for what it does....
In my fullstack workflow js is way worse than php.
Just to use it properly requires setting up an entire elaborate webpack setup (thank god for laravel mix), then there's a gajillion frameworks to choose from if you go that route, best practices are argued constantly on forums/reddit/hn....
I'd like to build an app on node but I can't ever get past bootstrapping the damn app before I get frustrated at the time it takes just to dive right in.
Ask me most days and I'll tell you how much I hate javascript... but I can't live without using it as it's pretty much the only option for what it does
Very true, unfortunately.
Just to use it properly requires setting up an entire elaborate webpack setup
This sounds like a self-imposed problem. I've been writing JS for over a decade and never touched webpack (I think it's some sort of compiler/linker)
there's a gajillion frameworks to choose from if you go that route
Emphasis on the word "if". Frameworks are there to make life easier; if they're making your life harder, don't bother. Most things are easy enough in "Vanilla JS", now that IE6 compatibility is less important.
best practices are argued constantly on forums/reddit/hn
Arguing over best practices is a sign of a healthy community, which is passionate about quality rather than settling for "it runs". Learning about new ideas can be useful for framing our thinking, even if we don't directly apply those approaches.
Those sort of arguments shouldn't have much impact on how we actually Get Things Done though, since we know more about the engineering requirements of our particular project than random people online, and we'll be more productive using known-good methods which we're experienced with.
I'd like to build an app on node but I can't ever get past bootstrapping the damn app before I get frustrated at the time it takes just to dive right in.
I've not used Node in years, but again that's a choice; if it makes life harder, dump it and use something easier. Node.js bootstrapping complications aren't really a fault of the JS language; heck, you can use FastCGI if you like (that's how PHP is often run).
I've not used Node in years, but again that's a choice; if it makes life harder, dump it and use something easier. Node.js bootstrapping complications aren't really a fault of the JS language; heck, you can use FastCGI if you like (that's how PHP is often run).
The bootstrapping issue is...that there's really no structure imposed.. I can setup an express script anyway I want, but I'm used to a little more syntactical sugar via rails/laravel world where you know where configs/migrations/models go. Sure I can set it up just like that, but having a go-to way of doing things is nice...
there's a gajillion frameworks to choose from if you go that route
Vanilla js is super difficult if you need reactivity and to maintain state across the app. I'm not sure there's many Single Page Applications or PWA applications that are built using vanilla JS (unless possibly you use Svelte which compiles down to vanilla, but still you're coding using a framework and not vanilla js regardless of what the output is).
It's still ugly and convoluted mess - the ecosystem. It's a lot like php was before laravel/composer (pre 2011).
Just to use it properly requires setting up an entire elaborate webpack setup
Webpack basically loads the scripts/files you need when you need them for specific parts of the app. It's similar to grunt/gulp and there are other tools out there. Laravel Mix sits on top webpack and has a simplified already configured way of using it, and it works for apps that aren't just laravel apps, so I often throw it in my workflow if I'm branching out or trying a different language or framework.
My point was just that php isn't necessarily the most hated, as I know plenty of people who hate js. They might even be equally hated.
Comments
You could say that about any language. PHP is loved by many programmers too.
Not to the degree that PHP is hated.
It's only hated by those who haven't grokked modern php > 7.0. Thanks to laravel the php ecosystem has grown quite a bit over the past few years. I know many rails devs who prefer laravel/php to rails for what it brings to the table. Sure ruby is prettier syntax, but php isn't as horrible as it used to be. Now if it could catch up on parallel/asynch it'd have a better time.
Sure there's sexier languages like elixir and go and rust, but well designed php code is a pleasure to work w/.
I’d argue PHP is so hated because of WordPress and the terrible code/practices associated with its ecosystem.
Amen to that, I live/breathe for laravel projects, I contemplate slitting my wrists when working on wordpress.
Laravel projects can be just as bad of a codebase as WordPress.
yeah, I'm working on one now (picking up where Indian devs left off) ... Code is laravel 5.2, every controller injects session, requests, etc into the constructor, then injects a 'manager' which is basically a loose repository structure, laravel 5.3 > somewhere makes it so using requests/sessions in constructor you generally want to wrap that in middlware...
So upgrading is a huge nightmare. This is one reason I'm not a fan of repository pattern, more classes to inject everywhere even when they're not fully needed. When just making a fatter model would suffice.
Also lots of bad php practices...everywhere else. Bad devs can work on any code base, but laravel core code is pretty beautiful, and laravel's community encourages better code, if some bad actors write shitty code the rest of us have to clean up that's on them, but woocommerce is owned by Automattic and has bad code, you'd think they'd fix it or something being a large company.
There's also tons of great packages out there that are written way more OO and with testing and best practices than there are for wordpress. Laravel is also easier to optimize, and the data structure for wordpress can get out of hand as well.
ltdr; Yes, lots of bad laravel code -- but that's on the individual dev, core laravel and lots of laravel packages use php best practices and encourage good coding. Easier to write better code in laravel than it is a wordpress plugin.
PHP is regularly found to be the most hated programming language
https://fossbytes.com/most-loved-hated-programming-languages...
We usually gain a better understanding of the world through numbers rather than booleans.
It's true that programmers hate PHP. It's true that programmers love PHP. It's true that programmers hate other languages. It's true that programmers love other languages.
This isn't very useful, as you seem to imply; but only due to the boolean perspective.
Numerically, PHP is hated far more than other languages, and loved far less (StackOverflow surveys come to mind, but I'm sure there's a whole lot more data on this)
The StackOverflow surveys only show you the data from the people who want to answer. It's always going to be skewed one way or another. I use and like PHP, and I rarely do the SO survey because I never see it in time.
I do think PHP holds a larger share of "hate" than most other languages.
I don't know... Ask me most days and I'll tell you how much I hate javascript and it's horrible ecosystem and incongruity...
but I can't live without using it as it's pretty much the only option for what it does....
In my fullstack workflow js is way worse than php.
Just to use it properly requires setting up an entire elaborate webpack setup (thank god for laravel mix), then there's a gajillion frameworks to choose from if you go that route, best practices are argued constantly on forums/reddit/hn....
I'd like to build an app on node but I can't ever get past bootstrapping the damn app before I get frustrated at the time it takes just to dive right in.
Very true, unfortunately.
This sounds like a self-imposed problem. I've been writing JS for over a decade and never touched webpack (I think it's some sort of compiler/linker)
Emphasis on the word "if". Frameworks are there to make life easier; if they're making your life harder, don't bother. Most things are easy enough in "Vanilla JS", now that IE6 compatibility is less important.
Arguing over best practices is a sign of a healthy community, which is passionate about quality rather than settling for "it runs". Learning about new ideas can be useful for framing our thinking, even if we don't directly apply those approaches.
Those sort of arguments shouldn't have much impact on how we actually Get Things Done though, since we know more about the engineering requirements of our particular project than random people online, and we'll be more productive using known-good methods which we're experienced with.
I've not used Node in years, but again that's a choice; if it makes life harder, dump it and use something easier. Node.js bootstrapping complications aren't really a fault of the JS language; heck, you can use FastCGI if you like (that's how PHP is often run).
The bootstrapping issue is...that there's really no structure imposed.. I can setup an express script anyway I want, but I'm used to a little more syntactical sugar via rails/laravel world where you know where configs/migrations/models go. Sure I can set it up just like that, but having a go-to way of doing things is nice...
Vanilla js is super difficult if you need reactivity and to maintain state across the app. I'm not sure there's many Single Page Applications or PWA applications that are built using vanilla JS (unless possibly you use Svelte which compiles down to vanilla, but still you're coding using a framework and not vanilla js regardless of what the output is).
It's still ugly and convoluted mess - the ecosystem. It's a lot like php was before laravel/composer (pre 2011).
Webpack basically loads the scripts/files you need when you need them for specific parts of the app. It's similar to grunt/gulp and there are other tools out there. Laravel Mix sits on top webpack and has a simplified already configured way of using it, and it works for apps that aren't just laravel apps, so I often throw it in my workflow if I'm branching out or trying a different language or framework.
My point was just that php isn't necessarily the most hated, as I know plenty of people who hate js. They might even be equally hated.