←back to thread

105 points robbyrussell | 3 comments | | HN request time: 0s | source
Show context
iamcreasy ◴[] No.45067211[source]
It was interesting to hear that Laravel, Drupal, Wordpress and Symfony communities do not mesh. I wonder why.
replies(6): >>45073249 #>>45073392 #>>45073689 #>>45073813 #>>45075153 #>>45075182 #
bakugo ◴[] No.45075153[source]
Symfony and Laravel are fundamentally ideologically opposed.

Laravel is designed from the ground up to be used by junior developers who don't care about pesky things like maintainability and scalability and just want to put out the minimum viable product as fast as possible, and with the least amount of work possible. It's full of "magic" abstractions built with the primary purpose of making the code look pretty at a glance to the inexperienced, completely disregarding good programming practices and even essential language features in the process, the programming equivalent of lipstick on a pig. It markets itself to beginners as "the magic framework that does everything for you" and is as big as it is today purely due to successfully capturing a large percentage of that audience.

Symfony goes in the complete opposite direction: it's designed to be used by experienced developers to build maintainable, extensible applications while employing good programming practices. It encourages you to "look under the hood" and understand how things work instead of just telling you "to do X, write Y" without elaborating. It has many convenience features but they're generally built on top of language features with good practices in mind instead of handwaving it all away. It's very modular and allows you to extend and/or replace almost every part of the framework with your own custom version if the included version isn't suitable for your use case. And so on.

One of the best examples of Symfony vs Laravel is the way database tables are mapped to PHP code. In Symfony, SQL tables are just PHP classes. To create a new table, you create a new class, add the columns you want as properties, add some attributes to tell the ORM how to map all of that to a table, and it's done. Your database columns match your class properties, every time you query the database you get instances of that class and can use them as a proper objects with properly typed fields.

Laravel, meanwhile, does none of that, your database tables are defined purely by the database itself at runtime, what they call "Models" are just empty classes that have the database columns injected into them at runtime as dynamic properties. You cannot know what properties your Model has just by looking at it, I believe you need a Laravel-specific IDE plugin just to autocomplete them. You're essentially working with glorified associative arrays the whole time. This alone is a massive red flag that should make any experienced programmer avoid Laravel.

Wordpress sits on its own little island as a big pile of legacy code that's almost frozen in time, full of bad practices that no self-respecting developer wants to touch. No lipstick on this pig, it's as ugly as it is obtuse. It's still commonly used today because someone with zero programming knowledge can load up a bunch of plugins full of security holes and make a somewhat usable site that vaguely matches their vision, but using it for any new project more complex than a basic blog is generally seen as a mistake.

Can't speak for Drupal as I have no experience with it.

replies(3): >>45075221 #>>45076047 #>>45076823 #
monooso ◴[] No.45076823[source]
Laravel uses the active record pattern, same as Rails. If anything, the Laravel implementation is the more pragmatic of the two.

It's fine if you don't like that pattern (I have my own misgivings), but it's a perfectly viable approach used by a lot of very experienced developers to build very successful applications.

Dismissing everyone who uses a framework or design pattern you dislike as "junior developers who don't care about pesky things like maintainability and scalability" is inaccurate, rude, and ignorant.

replies(1): >>45077124 #
bakugo ◴[] No.45077124[source]
> it's a perfectly viable approach used by a lot of very experienced developers to build very successful applications.

"Lots of people use it" doesn't make it good. Lots of people in the past have written "successful" web applications as loose PHP files with little structure, no classes, using associative arrays everywhere (including me when I was starting out), but today it's generally agreed upon that this is not a good idea and will result in more bugs, maintenance headaches and an all around inferior developer experience, so what makes "active record" different?

I'd understand your point if it had at least some advantages over the ORM approach to make up for the clear disadvantages, but I just don't really see any beyond "it seems easier and requires writing less code" (which, as I said, primarily appeals to beginner developers who just want to get things done as fast as possible and don't understand the long-term consequences). Are there any hidden advantages I'm not aware of?

replies(1): >>45078480 #
1. monooso ◴[] No.45078480[source]
> "Lots of people use it" doesn't make it good.

I didn't say it was good (or bad), I said it's a perfectly viable approach.

> Lots of people in the past have written "successful" web applications as loose PHP files with little structure, no classes, using associative arrays everywhere (including me when I was starting out), but today it's generally agreed upon that this is not a good idea.

You're right, which is why, in 2025, no experienced developer builds web applications in this way.

Plenty of experienced developers build web applications using the active record pattern.

>Are there any hidden advantages I'm not aware of?

You mean aside from others having a different opinion about the relative pros and cons of active record, or personal preference?

replies(1): >>45081599 #
2. bakugo ◴[] No.45081599[source]
> Plenty of experienced developers build web applications using the active record pattern.

Yes, but why? Why was the "loose PHP files with no framework" pattern abandoned, but not active record, when in many ways it's a remnant of the same era with many of the same drawbacks?

> You mean aside from others having a different opinion about the relative pros and cons of active record

I'm asking what the pros are.

replies(1): >>45084015 #
3. monooso ◴[] No.45084015[source]
> Why was the "loose PHP files with no framework" pattern abandoned, but not active record..?

Presumably because people still find active record to be a productive, sane, and scalable way to build web applications, unlike a disorganised collection of files.

> I'm asking what the pros are.

Speed, terseness, simplicity, and personal preference spring to mind.

You're talking as though there is some empirical "best way", but the fact is that every language, framework, tool, and design pattern has pros and cons, and those pros and cons will change depending on the project, and the individual.

Your list of pros and cons may differ to mine, simply because of personal perspective and preference, and that's fine.

Being blunt, I would expect an experienced, senior engineer to understand this.