Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I mostly work in Rails, but when I have to hop into a node project, it feels like I'm stepping back into PHP in terms of sheer madness.

Barely any convention, lots of repetition and configuration - all things Rails specifically set out to solve.



I had similar feelings with Rails. Just memorize this billion convention and you are good to go. Also didn't help that running Rails on Windows was (maybe still is) considered a bad idea.


Same here. Inherited a huge rails code base and it's as bad as any node project. The autoloading has been enabled in the entire project so I have no clue whether a class is defined within the project or is fetched from a gem. I've never grepped this much in my life


Is that still true with WSL?


I don't know for rails, but whatever dev I do on my Windows machine I just do it via VSCode in WSL2. Or I ssh into my dev machine (shared hosting via uberspace).

I haven't even tried to setup dev environments for python, php or js on Windows. It is just so easy to use WSL2.


No idea, but ideally that should solve it.


PHP hasn't been madness for a long time. One could argue Laravel (a RoR inspired framework) has become better than RoR.


I mean, there have been plenty of valid arguments against PHP the language and its standard library, but the big issue most people end up having have to do with its ecosystem, developers, and frameworks. My earliest rants about PHP was the sheer volume of bad tutorials; googling for "php sql" or whatever would invariably give you examples susceptible to SQL injection. And the other issue was that everyone was building frameworks, CMSes and forum software left right and center; there were a lot of islands, each with their own ideas, structures, etc.

PHP should have made a much bigger push early on; mark the weird and unsafe functions as deprecated and point to e.g. prepared statement alternatives. They should have built a package / dependency manager much earlier on. And they should have made a lot more efforts to get a developer community up and running.


If you're actually interested in the subject, a good way to familiarize yourself with the current state of PHP is to run through something like https://laracasts.com/series/laravel-8-from-scratch. It should give you a good idea of the current state of PHP, what educational resources look like, along with a taste of the most popular PHP framework out there.

These conversations always tend to go the same way; someone complains about PHP and then later admits it's based on their experience 5-10+ years ago. PHP has come a long way and is worth checking out if you're into web development.


I recall that when Active Storage was publicly announced[0], Laravel's Filesystem (itself a thin layer over Flysystem) had already been out for at least 2 years[1].

[0] https://rubyinrails.com/2017/07/21/rails-introduces-active-s...

[1] https://laravel.com/docs/5.0/releases


I came here to say that, as someone who's used both Rails and Laravel.

Basically it comes down to magical behavior, and the fact that Rails has way too much of it. Syntactic sugar and DSLs are maybe fine for rolling out new projects, but become burdensome on large codebases. I was on a large project and found myself in goto hell where I literally couldn't trace through the code. It was relying on every magic trick in the book to make the code as small and cute as possible, but failed utterly to provide anchors in the code where "this happens here" or breadcrumbs connecting chunks of code. It was a giant hodgepodge of I don't know what. Really clean spaghetti code I guess.

Now, Laravel has its own warts, but they aren't conceptual warts. For example, the stack traces in Laravel are way too tall, with way too many factories and patterns in the vendor code. I feel that things like the IoC container were not implemented as well as they should be. The goto hell in Laravel happens around stuff like the bootstrap process, registering service providers, queuing, etc. They made some mistakes in scattering those things around instead of handling them in one central place. Pretty much all classes provide 95% of what you need, but adding missing functionality yourself requires learning the entirety of the package (in fairness, this happens with pretty much all platforms). There's a tendency for Laravel projects to not support helper functions or custom classes in a standardized way, so sometimes it's hard to find business logic. Not nearly as hard as in Rails though. But as a whole, I'd take conceptually clean interfaces with mundane implementations and no surprises over magical behavior any day.

Just to not leave anyone out - I wouldn't implement business logic in any Javascript framework. I feel that async basically makes it impossible to do it deterministically. I'm sorry that happened to Javascript and am still in mourning about it, because it had some advantages over PHP in how it treated associative array access with "[]" the same way as object member access with "." which could have been used in PHP to implement copy-on-write everywhere and really set it apart from all other imperative languages. Mistakes were made in both, and Ruby as well, that took them all in directions that I wouldn't have chosen.


So what do you like then?


You know, I wrote up a long response about what strikes me as a good framework, but realized that the core of it is that a conceptually correct approach may not need a framework:

https://sive.rs/pg

Today I mostly write solutions in a synchronous-blocking, functional-reactive, event-driven, immutable, stateless, data-driven, declarative manner that tries to avoid custom types/objects, manually managing nulls or asynchronous behavior. Which if all orchestrated correctly, leads to future-proof code because it's so obvious that it's self-documenting and the failure modes are all safe.

IMHO, the vast majority of software out there involving Javascript, Ruby, Python, really any of the imperative languages, can't achieve what I'm trying to do. It even feels like they actively work against me sometimes. I think of Laravel as getting most of the interfaces and approaches conceptually correct, even if the internals use factories and patterns and hand waving that I consider spaghetti. Whereas Rails involves some element of drinking the kool-aid, because it encourages some conceptually incorrect approaches like ignoring process separation to achieve better performance or fit with some preexisting notion of what's beautiful or easy. Along those lines, probably stuff like Phoenix/Elixer, Erlang, etc are closest to what I'm working towards, but they introduce their own custom syntax that strikes me as perhaps too DSL-like and I have an aversion to that. Which is the main reason why I struggle to learn stuff like Haskell.

There truly are vanishly few actually good solutions today, and I've been following web development for over 25 years now. That used to really get me down. But I realize now that the situation presents an opportunity to fix things and build a better future, which I am grateful for.


as a former Rails user now Laravel user, I would agree with this.

PHP has mage huge strides in typing too, I havent kept up with Ruby to know if they do the same


Unfortunately Ruby's typing story is abysmal. I hope they manage to improve it soon, otherwise I fear the language will continue to flounder


Sure, community interest peaked around 2014, but usage among enterprise and startups is higher now than it ever was. Ruby is boring now because it works.


No - typing is still basically a complete after-thought in Rails.

Sorbet is trying, but it's... not there yet (although getting better).


If you want typing in Rails, you're in reality itching to try Crystal lang and most likely Amber framework. Much faster too as it's a systems language.


I’m itching to try Crystal, since it has goroutines aka. greenthreads aka. fibers for easy concurrency, static types, automatic null checking, and performance on par with Golang.

But Crystal has around 468 open bugs at the time of writing :(

https://github.com/crystal-lang/crystal/labels/kind%3Abug

Issues are well over 1k…


I did run a startup for a year that was on crystal, and I will say the community is quite good at addressing real bugs. There are a lot of "you don't know what you're doing" bugs and "this is already fixed but you haven't updated" bugs and "this is really a feature request" bugs in the tracker. I wouldn't read into it much. There hardly exists a popular programming language or framework without at least several thousand open issues.


As the commenters pointed out, Express.js doesn't try to solve the same problems as Rails. Trying to use one for the other's use case doesn't make any sense.


Yes, but the problem is that there's still nothing in the node ecosystem that's as complete as Rails. Fine, express.js isn't going to do the job. Neither is anything else.


This isn’t really true though, NestJS for example is very opinionated and similar.

The issue is more that Node and JavaScript in general is too popular and there are way more options whereas ruby is rarely used for non rails work.


Python is plenty popular and so is C#, and when you're looking at a batteries included full stack framework you have ONE popular choices - Django or .NET. For PHP it's Laravel (sure, you have other options like Symfony but they are niche), for Elixir its Phoenix. How is it a good thing for Node to have 5-10 competing frameworks that have similar adoption?


> How is it a good thing for Node to have 5-10 competing frameworks that have similar adoption?

How is it a bad thing? Again, JavaScript is far more popular than all of those for web related development. The issue is that like you're stating, there isn't a single main option perse. I'd use NestJS.


I think its generally bad, or at least I wouldn't want no part of it. There's decision fatigue for one - how the hell do you decide what to use. Another problem is why would I want to relearn a new framework every time I switched companies? And how do I know these frameworks are going to survive long term in such a chaotic community? I have little doubts Django or Rails will be here in 10 years, can you be confident all these JS frameworks will still be here? Some will and some will probably become irrelevant.


As the other commentator pointed out there are a few options that do have a complete setup. NextJS, SailsJS, and Gatsby to name a few.


Yes Next, Nest, Sails, Gatsby, Blitz, Redwood - none of them became a leading framework like Django or Rails or Laravel has, which means being a Node developer and moving between companies or projects you'll probably relearn everything in a different framework. For me this is just to chaotic and unstable.


I see no difference. PHP has a billion FWs and a billion more CMSs. Python is the same way. Rails is the only example you give that has merit. I mean PHP is a terrible example. I've been coding PHP since around 2007, PHP has Zend FW, Laravel, Cake, Ignitor, Symphony, Silex... it keeps going and going. All I can see from your comment is some biases against JS. You do you on what you want to learn or use. But its not really an argument that holds up imo.


Laravel is the leading PHP framework by far, I don't think it's up for debate. Ruby also has many frameworks (Padrino, Hanami) but it's obvious Rails is the common choice.


Laravel is as much of a leading framework as React/NextJS are the leading frameworks for JS(next 2.5 million weekly downloads on npm, react 15 million). Its almost a 1:1 comparison. In the same way that I already pointed out JS like php, has a million fw but insiders know what the leading ones are. Everyone knows React is the clear on top winner. NextJS is also a clear on top FW. I dont think its up for debate at this point.


Yes, and in the Ruby world we also have Sinatra, but notably, people have tried and failed to get Rails-like frameworks up and running in JavaScript (Sails.js, others). The question is whether the problem is the language or the community -- I think it's a bit of both.


Your idea of what PHP is is old, that comparison doesn’t really hold. Laravel in particular is extremely advanced similar to Rails.


I've used Laravel and agree that PHP isn't all bad and can be used intelligently. And this is coming from a former CodeIgniter core dev (if you recall). But being real, you've got to admit that most PHP projects aren't in Laravel, they're batshit spaghetti code continually reinventing (or outright ignoring) the standard patterns that come in a boilerplate rails projects.

That probably has more to do with PHP being such an easy language to get started with, inviting a lot of rookies/cowboys to the party.


I find you have to create your own structure (in almost every instance, I drift back towards MVC, though it's generally hand-rolled)

Express isn't terrible; it's just more like Sinatra.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: