3 ms·
I don't like their code and architecture though. The code is ugly because it is built around static methods instead of proper OOP, and uses magic methods a lot.
by codedokode 7y ago
I don't like their code and architecture though. The code is ugly because it is built around static methods instead of proper OOP, and uses magic methods a lot. It is not easy to read.
Also, they love to invent their own names for existing things. For example, they named a folder with interfaces as "Contracts", although there are only interfaces.
You are using "Ruby on Rails" as some sign of quality, but if it uses magic and static methods like Laravel, I would consider it ugly too. Also, I remember reading somewhere that they were hotpatching imported modules. Luckily in PHP you cannot do it.
- astrodust 7y agoIf you think Rails is ugly you're going to have to frame this with what you think is beautiful so we know where you're coming from. Rails does take a lot of established concepts like MVC and mangles them pretty badly, but the Rails version of MVC works well in practice if you're willing to overlook how unconventional it is. The beauty is not in the adherence to dogma, but the day-to-day experience of using it when you know how it works. It takes surprisingly little code to do some complex things in Rails. I'm working with GraphQL now and it's stupid easy to build out an API with Rails. Laravel might seem all sorts of "wrong" to someone who has expectations of "how things should be", but the Laravel way, when accepted for what it is, works. It provides structure and cohesion which in the PHP world is in extremely short supply.
- chipotle_coyote 7y agoThe static methods you are seeing are by and large facades -- convenience methods -- but Laravel is still absolutely "proper OOP." https://laravel.com/docs/5.8/facades https://laravel.com/docs/5.8/facades "Contract" is not a term they invented; it's a term from "design by contract programming," and Laravel enforces the "contracts" through interfaces. https://en.wikipedia.org/wiki/Design_by_contract https://en.wikipedia.org/wiki/Design_by_contract (And, no, they did not invent the term "facade," either.)
- dabernathy89 7y ago> it is built around static methods instead of proper OOP The fake case against Laravel that never dies . The truth is found in the docs: https://laravel.com/docs/5.8/facades https://laravel.com/docs/5.8/facades > Facades provide a "static" interface to classes that are available in the application's service container. Laravel ships with many facades which provide access to almost all of Laravel's features. Laravel facades serve as "static proxies" to underlying classes in the service container, providing the benefit of a terse, expressive syntax while maintaining more testability and flexibility than traditional static methods.
- the_duke 7y agoWhat isn't fake is that Laravel uses magic methods everywhere, especially in the ORM layer. There are way too many magic things happening under the hood for my taste.
- munk-a 7y agoMagic methods in PHP are very commonly used to help reduce code verbosity - having come from working mostly in C++ I appreciate being able to express things succinctly.
- malinens 7y agoMuch more important for code, especially library code is readability
- mjlangiii 7y agoLaravel is moving away from magic methods to using facades, FWIW.