Live data from Hacker News

PHP is the new JavaScript?

mux.com

71–80 of 88 posts

Re: PHP is the new JavaScript?

#71

I don't really get the hype for Laravel over Symfony, or the joy of writing prompt instead of actually coding.

Yeh I got up to the repeated bits of having an LLM do the work and gave up because it's indistinguishable from all those articles shilling AI as productivity tools.

Re: PHP is the new JavaScript?

#72
post #57
post #8

> What happened? Well. Laravel happened (and has been happening). Funny, because Laravel was one of the things driving me away from PHP, in the same way that Rails drove me away from Ruby. PHP was becoming a salvageable language with some of the 7.0 changes, but if you don't dump 1000 pounds of gunk on top to make the easy things hard and there hard things dang near impossible, then you're not a "web artisan", I gues…

ORMs only make easy things slightly easier. Complex queries are not expressable in ORMs, so you need SQL queries (usually as strings, in external files or generated with a tool like jOOQ/LINQ). I think just doing all with SQL is easier to understand and maintain. I see no benefit of ORM considering the small benefits vs cost of learning. And your code become hugely dependent on them.

Agree 85%. 10% relates to cases where you want dynamically- generated queries, which is why Phrebar has facilities to help with this.

No off-the-shelf ORM that I've ever used has done anything but get in the way.

Another 5% disagreement over whether they even make easy things easy. They often require some contortion of your application code in order to work at all, like annotations or inheritance on value objects that lead to them being coupled to a specific data source.

Re: PHP is the new JavaScript?

#73
post #64

What ever happened to Hack ( https://hacklang.org ) the language Meta built as a superset of PHP? Why not take an approach more similar to TypeScript? I sometimes do wonder if many of the server side rendering approaches (or alternative Node runtimes) would be better off trying to emulate some aspects of PHP

What would you want from typescript?

Static typing

Re: PHP is the new JavaScript?

#74

Earlier quoted context omitted.

"the ORM didn't support composite keys" Well composite keys are a bad idea, so maybe it had a reason for that.

Composite keys are fine as long as all the key columns are surrogate keys.

High bridges without guardrails are fine as long as you don't fall off.

Re: PHP is the new JavaScript?

#75

Earlier quoted context omitted.

Composite keys are fine as long as all the key columns are surrogate keys.

High bridges without guardrails are fine as long as you don't fall off.

Using composite keys can help prevent you from representing invalid states in the database or in your application. They can be guardrails.

Re: PHP is the new JavaScript?

#78
post #68

How is this better than rails?

I agree. I do rails stuff, and recently I've been doing some laravel stuff. Ruby+Rails is just so much better than anything PHP could offer. Rails feels much more ergonomic than laravel, and the syntax is much cleaner.

It feels like Rails developers are just absent from all these online discussions because they're too busy living happy, fulfilling lives.

Every time I have to work with another technology, I end up wishing it could be done like Rails.

Rails's drawback is that with enough before/after filters it feels like logic is hard to grasp, but it still turns out to be better than any alternative I could of. The laravel middleware approach is much more cumbersome and less powerful.

Re: PHP is the new JavaScript?

#79
post #65

Forget the framework, forget the AI assistant. What are PHP developers like these days? Awhile back, we wrote an MVP, a proof of concept, using Wordpress. I dug around some of the plugins and themes we used, and my god , it's still garbage. Things being shipped with huge swaths of code just commented out, spaces & tabs intermixed for indentation, TODOs littering the codebase. Things that were just flat out broken . I…

> using Wordpress Wordpress should be avoided like the plague if you care about code quality at all. It actively encourages bad code and this will never change. PHP programmers being conditioned to write low quality code due to their experience with things like Wordpress or other legacy bespoke codebases that aren't built on top of good programming practices is a real problem, and using a modern framework alone won't…

> if you just hired a straight up incompetent developer, they will likely end up writing unmaintainable spaghetti no matter how much they're pushed in the right direction

I'm currently dealing with a laravel app. Said app has an 18,000 line "AdminController", and a 7k lines "WebController"

These contain all the logic. No, I'm not exaggerating. Model files are empty, save for 4 lines of model declarations. It's a whole CMS written in a SINGLE FILE. of course, such a dumpster fire can't exost without copious amounts of copy-paste, of which there indeed hundreds.

I'm talking multi-levels of nested if conditions, each with many branches, and said branches are very well over 10-20 lines of code that only differ by a single word.

And I won't even get to the disgusting mess that is the view templates... Let's just say they follow the same principles as above, except the original developer was unfortunately constrained by having to create a separate view file for each controller method.

Re: PHP is the new JavaScript?

#80

everytime I see PHP and python, it reminds that the best of the three main languages in the "slow / overly dynamic" lane (Ruby) got the short end of the stick for some reason, it's terrible

Python is pretty magical in places. PHP is slightly magical in places. But Ruby is magical everywhere.

Ruby is real fairt tails magic, and using it makes me so happy. Ruby makes me feel like Cinderella in her dress, except there is no midnight time limit. And the carriage os Rails.

Ruby also has the cleanest syntax of the three. Php and python are downright ugly in comparison.

Post reply on HN