News for hackers. Stuff that matters.
Re:PHP Popularity: Is it decreasing and what to do about it? by DonHopkins on Friday April 21, 2023 @05:08PM (#35660195)
What is the PHP equivalent of writing your front end and back end in the same language so you can share libraries and data and not have to switch gears between two different languages each time you look up or down the stack?

There is a HUGE advantage to using the same language in the browser and on the server, and PHP isn't ever going to displace JavaScript in the browser. So JavaScript it is. That ship sailed a LONG time ago.

Re:PHP Popularity: Is it decreasing and what to do about it? by archerx on Saturday April 22, 2023 @01:43AM (#35663714)
I like switching gears, I truly don’t find it an advantage using the language for both. Have separate languages makes the distinction between backend world and front end world very clear. Also the backend code is mostly data manipulation and the front end code is mostly rendering so there is very little overlap in similar functions for both. The separation helps keep things tidy in my brain.

I much prefer not having to write JavaScript everywhere, not every problem is a nail and not every solution requires a hammer.

Re:PHP Popularity: Is it decreasing and what to do about it? by ihatepython on Saturday April 22, 2023 @02:40AM (#35663978)
Don't you think it would be better to write everything in HTML? It wouldn't be too hard to make it Turing complete. This way your server is written in HTML, your browser is written in HTML, no more switching gears.
Re:PHP Popularity: Is it decreasing and what to do about it? by ThatPlayer on Saturday April 22, 2023 @07:06AM (#35665295)
I believe you'll need to compile the PHP runtime itself with emscripten, since LLVM won't take PHP code, but PHP compiled to wasm will!
Re:PHP Popularity: Is it decreasing and what to do about it? by pjmlp on Saturday April 22, 2023 @03:46AM (#35664286)
As long time Java, .NET and C++ developer, this is oversold, beyond some form validation there is hardly any value sharing code.

And in what concerns validation, it can be automated on most frameworks, which has to be done on server side anyway due to security concerns.

Re:PHP Popularity: Is it decreasing and what to do about it? by toyg on Saturday April 22, 2023 @05:38AM (#35664817)
The value is really not in sharing code, but rather sharing developers. Instead of having to assemble and keep happy a diverse group of specialized professionals, you can just hire and fire a bunch of cheap JS folks, who are easily replaceable.
Re:PHP Popularity: Is it decreasing and what to do about it? by pjmlp on Saturday April 22, 2023 @06:33AM (#35665091)
Offshoring already takes care of the cheap developers part.

When people get what is peanuts in local currency of the owner company, whatever they are using doesn't matter and most sweet shops are experts in everything.

I can also tell that at the level I work on, salaries are the same regardless of FE, BE, DevOps, ...., specially because no one has a single role.

Re:PHP Popularity: Is it decreasing and what to do about it? by DonHopkins on Saturday April 22, 2023 @06:17AM (#35665008)
toyg makes a good point about sharing developers, but also sharing code is important, especially for efficient server side rendering, with view code that runs on both the server and the browser.

The point is it takes fewer people (or even the same person) to write less code (instead of writing everything twice, then trying to keep them in sync forever).

There's a fascinating deep discussion about SveltKit and other frameworks here:

Reacting To Web Hot Takes from Rich Harris - SVELTE STUFF

https://www.youtube.com/watch?v=JGuUY7dZhWs

Re:PHP Popularity: Is it decreasing and what to do about it? by pjmlp on Saturday April 22, 2023 @06:34AM (#35665102)
Java and .NET have been doing efficient server side rendering for several decades now.
Re:PHP Popularity: Is it decreasing and what to do about it? by paulryanrogers on Sunday April 23, 2023 @10:31AM (#35676544)
LiveWire?