I'd love to read more discussion about though.
So I'm cheering for this one to stay up as well.
I'm not a particular fan of Ruby itself but I can appreciate the value that Rails brings. The interview with DHH was quite interesting... DHH is not someone I find I've always agreed with but his opinions nonetheless always seem reasonable and thoughtful. It seems useful to have someone that Zigs when the rest of the industry Zags.
There's a huge amount of value in having an ecosystem of components that are designed to work together, and randomly choosing "oauth X" and "smtp Y" components and trying to string them together, vs using a battle-tested and supported stack, just invites a lot of hurt.
If you have a team of Java web app devs, having them build a web app in Rust or Go will be incredibly costly and inefficient. It seems very obvious to me, but I still get people that say "oh, it's not that hard - library X can do all of that other stuff"... but inevitably it can't. And the communities of people doing web app stuff in (Rust, Go, Scala, etc) just aren't big enough to provide the community support other frameworks provide.
Kudos to the author for their epiphany.
I am unapologetic about despising Ruby - Rails is pretty darn good, though. The Rails and Djangos of the programming worlds are critical for many teams that shouldn't be building their own frameworks from scratch (for any number of reasons).
Attempts are being made (https://loco.rs/) and time will tell if Rust can put together a compelling story for this use case.
There's no reason why Rust can't have its own Django. And the day it does I might switch to it for my new web development gigs. In the mean time having access to all my tools with a promise of stability and uniformity will beat the convenience of any one specific language.
Rust is well on the way to having a Rails/Django.
That said, here are a few examples:
- https://github.com/levkk/rwf
- https://tokio.rs/blog/2024-10-23-announcing-toasty (Tokio is beginning to assemble the pieces: Axum, Toasty, etc.)
I'd argue that the ability to do `python manage.py shell` and get an interactive ORM session for debugging is a fairly major reason why Rust can't have it's own Django.
I don't know if that's a good idea, but for much of what I personally used the django shell for (did this record get written the way I expected) it could help. Wouldn't help for situations where you want to monkeypatch the running app at runtime (but it's arguable whether you'd want to do that anyway).
> Does it turn into unmaintainable spaghetti code after a while? Only if you let it. It's typically caused by developers, not programming languages or frameworks.
After running a number of rails applications in production for going on a decade, this is really hard, and I find it to be one place where rails (really ruby) doesn't help much.
Of all the languages we work in (and it's quite a few), ruby has the worst support for modern language tools: the LSP implementations are weak, and don't play well with containerized development environments. Typing efforts are fractured, and the official way is... well.. it's bad. This is exacerbated by ruby's tendencies towards "fluent" interfaces, which is actually code for lots of methods that take undocumented hashes of arguments --- and hash access with strings and symbols? nightmare fuel.
But I still come back to rails. It's productive, it's fast enough, it scales just fine, and perhaps most importantly there's a "right" way to do just about everything your web application will ever need to do: background jobs, websockets, read-only database replicas.
All in all, its still my recommendation for new web projects going into 2025.
A good chunk of chaos in Rails apps is caused by people who either insist they know better than the out-of-the-box solutions, or they “just prefer it my way.”
ActiveRecord can both offer fast development and create issues (especially those that only come to bite you later). It exists in a multi-faceted environment. Tradeoffs, as always.
I think most would agree. It is the "doesn't make much sense" part that we're discussing, though. How does it not make sense when you seem to have the same opinion of it? It seems, as an onlooker, that it makes perfect sense to you.
Well, what remains of Rails or of ActiveRecord once you remove the part that's done outside the database? It just seemed like a very shallow view of what rails is.
It is just not tenable where latency poses a practical constraint under an implementation that is not theoretically sound. There are plenty of hacks to work around it, though, so it is not really a problem in practice. To call those hacks to work around a system with shortcomings "using the database properly" is a bit of a stretch, though.
Just so we're clear, the use of JOIN, IN, etc. are not hacks in and of themselves. They serve a purpose even where latency doesn't exist. But when applied to solving the N+1 problem, their use is a hack. Again, one that gets the job done and solves the problem – hacks aren't bad, but is not theoretically sound. If you did not have latency constraints to contend with, you would not prefer it.
The better question is: Why use a database that sucks? Latency periods are small enough in SQLite, for example, that you don't have to worry about the N+1 problem in any real-world situation. It doesn't have to be a problem in need of hacks.
Previously, ActiveRecord gave newer programmers a legible, fluent interface to the database in a language they already knew. So instead of learning SQL, we abused the heck out of AR. I think that the industry, and rails itself, has matured since then and I see a lot less of this nowadays.
EDIT: I'm not bothered by this, but this is a very odd comment to downvote. What on earth is so offensive or distracting about saying someone else is likely more knowledgable than you are? Very confusing.
I say this genuinely enjoying JavaScript programming, but my mind immediately jumped to "as opposed to immediately, like most JS frameworks?"
Does HN not use lockfiles or something? Your node/npm project will work just fine if you use the same version of node/npm and have a lockfile.
Maybe you're using npm i (which can upgrade dependencies in some cases) instead of npm ci [0] (which always uses the lockfile dependencies).
In any case, this is a general problem of package managers and has nothing to do with the language. You'll need something similar if you're using _any_ external dependency in Rust, Python, Go, etc.
I've spent my whole career on Rails and I think it's amazing when starting small but mature applications are a nightmare to refactor. Every monolith Rails app feels like it hits tech bankruptcy after ~5 years.
I've been using Rails since 1.0, owe much of my career to it, and still think it's an incredible framework that I love using.
But I have seen plenty of startups—mostly filled with junior developers—who don't have the maturity and experience to avoid some really bad ideas absolutely wall themselves into a corner. Thankfully the worst of this was in the Ruby 1.8 and Rails 2.3 era, but it still happens today.
A lot of the issue is the tendency that Ruby libraries have toward exposing internal details that end up getting relied upon (Hyrum's law in action).
With a sufficient number of users of an API,
it does not matter what you promise in the contract:
all observable behaviors of your system
will be depended on by somebody.
(There's something about the way people manage to phrase these that I really enjoy. Something about the succinct and clear expression of an idea that's otherwise really fuzzy in my head.)It's interesting to think about the implementation being necessarily coupled with the interface. In some context that's obvious, but the idea that another implementation can't be freely swapped in -- because nuanced behavior (sometimes called a bug) in the original implementation is still expected -- is one I hadn't, as such, thought much about before.
I think the fact that we are trying to shove typing onto Ruby with Sorbet and RBS are a sign that maybe it's not the best programming language once you reach critical mass.
It's possible the grass is greener and this is what happens to every tech department... but I'm not totally convinced. I always hit a point with Rails apps where I can see the refactorings I'd like to make but I know it's not worth the pain of the inevitable `NoMethodError` at run-time in production. And that's _with_ a giant test suite.
Anyway over 10 years later now and I find myself writing an API and my initial thinking was to return to rails but then I remembered the bad experience (which was probably my own fault I acknowledge).
Now I find myself writing this API in Rust because the ethos that an app can actually be done is attractive to me. It's taking me longer to write but hopefully I've made a good decision!
The API I'm working on is pretty simple and I want to finish it and forget about it so in my circumstances it seems that rust is a better choice.
If someone gives you a paint-by my-numbers page, and you just scrawl all over it… is that the “fault” of the page?
* Time from idea to deployed solution * Ease of pivot * Ease of finding other devs who can take over
If I were a staff engineer at a large company with an existing tech stack tasked with spinning up some new internal microservice, I'm probably not choosing Rails.
But if I'm truly greenfield on a strict budget, still searching for product market fit? If that application ever truly outgrows rails (and it can become wildly successful without doing so --- look at stripe, instacart, github, shopify) then we've already won by surviving long enough for rails to be the problem.
This is exacerbated by ruby's tendencies towards
"fluent" interfaces, which is actually code for
lots of methods that take undocumented hashes of
arguments
Well, I hate this too. I've been away from Ruby for 18 months but my impression was that the community has been moving away from that for a long time and toward keyword args (or whatever they're called, I forget) and hash access with strings and symbols? nightmare fuel.
What's the alternative? I like hash access with symbols. Prevents typos and the string values for the hashes are interned AFAIK. After running a number of rails applications in production
for going on a decade, this is really hard,
I don't feel that Ruby is worse than other languages I've used extensively (Ruby, Python, JS, C#) in this regard.The issue is one's apps dependency graph. You keep dependencies flowing in one direction. Or you do not and you get spaghetti. I have not worked with languages that are really better or worse at this.
To take the example of a typical Rails app: it's very easy to add code to your Model A that depends on Models B, C, and D. Do that in a few models and...boom! spaghetti! Rails does not discourage or warn about this in the slightest.
It's relatively easy to avoid: have a rule that "no model can contain a reference to another model. if you have to do a thing that involves two models, put it in a service class" or some such. Of course, nobody ever does this.
Are there languages and frameworks that encourage/enforce The Right Thing in a more active way?
I don't think so, as evidenced by the fact that I'm still so pro Rails after a decade of doing this. But that doesn't mean we can't be vocal about the things that still suck.
> I like hash access with symbols
Oh, I vastly prefer symbol access to string access, but this is really a ruby problem, not a rails problem. The fact that I can pass `{ "foo" => "bar" }` and `{ foo: "bar" }`, and my method has to either call `with_indifferent_access` or _strictly_ enforce being called with one of the two access types is a huge footgun, because improper access doesn't result in an error, it just results in a `nil`.
Official way? I thought there is none.
As long as there is no support for gradual typing in the core language it will never be used outside of niche programming.
And then I have a hard time imagining that Rails would use it anyway. Unless the performance boost would be tremendous.
is the "officially supported" one. It's terrible, as is Sorbet. No offense to anyone involved with either of the projects, they just miss the mark in pretty fundamental ways.
Keyword arguments and pattern matching have improved this quite a bit, but not everybody is using it yet. I'm not sure how much Rails is using it either, which doesn't help.
It's def a dicey situation, but improving.
Best sentence in the article. I’ve worked in well-organized and reliable PHP apps, and giant buggy abortions in TypeScript. Lots of Rails apps with varying degrees of quality. Languages and frameworks can’t fix disorganization, poor architecture, laziness, or most of all, ignorance of how the Web should work (and why.)
The main predictor of how good your app will be technically, is the skill level of your worst developers + how much your best developers care (or are allowed to care, which necessarily varies with business conditions). Regardless of if you’re using trendy languages like Rust, TS, etc.
Of course, while as hackers we desperately wish for the app to be of very high quality, the sad truth is that companies who always obsess over the finest details under the hood don’t tend to perform as well financially as the ones who make compromises to get things to market faster and pivot more effectively, so I think that’s why most of us have rarely worked in commercial codebases where nothing is embarrassing.
> There are plenty of ways to nicely organize your code and you should probably spend more time refactoring.
Ruby/Rails makes this a time consuming process as compared to many alternatives. If you have all the time in the world, Rails is great, but for the rest of us that also have to think about productivity...
People love to blame the language and the framework, but in reality once you're past the proof of viability point, it's usually worth taking the time to review some of those initial decisions... except now you need to GrOw! :)
The fact that it's rails is irrelevant. It could be any tool that makes you really efficient by never erecting guard rails.
> Few people know Ruby and if you ask a company whether they want to hire PHP or Ruby guys, PHP wins because there's just more people who know it.
https://board.phpbuilder.com/d/10312349-php-frameworks-which... (First example I found, but was a common trope back in the early days of Rails)
Building new Rails apps is a blast, but dealing with old Rails apps is a pain, they're difficult to refactor. New Rust apps are great, and dealing with old Rust apps is a much better experience as they're easier to refactor.
I am working on an app that has a frontend in Django and the backend in Go and when I make changes to the Go side I just feel a lot more confident it'll all work as intended. Compared with Django I keep finding myself in the weeds debugging why some random dependency is misbehaving which is difficult because python allows you to do some really heinous stuff like instantiate classes that are chosen using runtime configuration.
Rails was built for the last cost-cutting era, so it seems relevant again.
Well, that is the issue of modern software development. People download even packages like `is-number` which is in the end few lines of code.
Indeed SvelteKit is basically like NextJS for Svelte. It's just a thin server layer + routing which enables SSR, form submissions, and a few other goodies.
You don't get the kitchen sink like with Rails.
Just off the top of my head here's things you get with Rails that you don't with SvelteKit
- auth (new in Rails 8)
- background jobs
- email processing
- database connections and ORM
- caching layer
By the way this is coming as someone who is a fan of SvelteKit, it's just not objectively the same nor an evolution of rails at all.
I suggest trying it out, it's pretty cool.
So far rails has been my favorite to rediscover, I used it 10 years ago and boy has a lot changed!
I was hoping to like django more since I'm a professional python dev, but django felt like I was still clobbering together libraries (whitenoise, celery, etc) and it doesn't have a great front end story.
Laravel was super slick, but I just can't do PHP. I know it's come a long way but it's just not for me.
Rails really stuck for me the most and I really like the hotwire paradigm. As a dad with limited time for side projects Rails is going to be the tool for me now to spin up something quickly.
I'm actually porting over a current side project to rails and stumbled on this magical gem called "Brick"[0]. You just point it at your existing DB then it reads the current state of the database and makes active record models in memory for you to play with. You can then eject the models and controllers into your code base, and bam you have your model layer recreated in rails.
This is my issue too!
The webdev race has sort of left python behind.
I totally agree it looks totally outdated nowadays and I wouldn't pick it over the other alternatives. It's incredibly how bad it looks if you're going to need anything else than an API.
Rails brings a certain intolerance to BS - boilerplate, verbosity and in general anything that gets into the way of flow.
Neither are as trendy as nextjs/sveltekit etc, but those are not really comparable to rails.
[1]: https://adonisjs.com
[2]: https://sailsjs.com
Actually, in recent Rails versions the mistakes of Webpacker have been replaced with much more flexible gems for building frontend assets with esbuild, vite, or any other build tool.
This gives the ability to seamlessly blend the nice pre packaged rails ecosystem with the nice ecosystem of react components or other modern frontend tooling most people are using.
I close this comment with mentioning: you still may not need all of that new stuff! What does your app actually do?
Turbo, stimulus, have their own pitfalls. I have worked with them a fair amount and have ran into headaches. Also, React has a massive community / ecosystem of ready made components, plugins, tutorials, etc. Turbo and stimulus are getting better on that front, but it is nowhere close, and many situations/patterns you have to figure out yourself.
Theres weird hate on React from a portion of the rails community that seems unwarranted. Probably because of some of DHH's commentary.
In my opinion the ionvestment is not so much in the code, than in the design.
Rails' is what people are going for when they choose it, not Ruby (generally speaking... there are obviously people who like Ruby). Rails provides all of the tooling, conventions, and ecosystem needed to tackle a great deal of web development projects.
Rails is a great example of a killer application. People learned Ruby just so they could use Rails. Wanna make a bread-and-butter website, just build it in Rails. Three-quarters of what you need is available in the framework itself and most of everything else is a library that integrates seamlessly with the framework.
If you need to use a systems-level language to solve a technical problem, you'll know exactly why you need to go through the trouble. If you're using maxims to justify your choice, you have no idea. "Because it's blazingly fast," doesn't matter if -- as the TFA points out -- your most heavily-trafficked endpoint is serving a p90 of < 400ms, your team is delivering the features you need on time, and your users are happy.
I think there are lots of good reasons to use a Rust-based framework. I work in Haskell full time. I get it. But there are huge trade-offs. The most obvious one is that almost no SaaS or open-source components you use will ship Rust or Haskell SDKs. They will ship libraries that integrate with Rails.