7 ms·
Rewrite it in Rails
- jsnell 2y agoDiscussion two days ago, 239 points, 219 comments: https://news.ycombinator.com/item?id=42024246 https://news.ycombinator.com/item?id=42024246
- hakunin 2y agoDupe https://news.ycombinator.com/item?id=42024246 https://news.ycombinator.com/item?id=42024246
- hu3 2y agoyep, 2 days ago. I'd love to read more discussion about though. So I'm cheering for this one to stay up as well.
- chrisfosterelli 2y agoChangelog had a podcast come out with David Hansson (the creator of Rails) a few days ago: "Rails is having a moment (again)" https://changelog.com/podcast/615 https://changelog.com/podcast/615 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.
- mgkimsal 2y agoMany make the same argument about Laravel, Symfony, ASP.NET, etc. 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.
- eximius 2y agoThis is basically the outcome of not having fulfilled this: https://ntietz.com/blog/rust-needs-a-web-framework-for-lazy-developers/ https://ntietz.com/blog/rust-needs-a-web-framework-for-lazy-... 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/ https://loco.rs/) and time will tell if Rust can put together a compelling story for this use case.
- Daishiman 2y ago100%. Python and Ruby are used for web dev because of Rails and Django, not the other way around. 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.
- echelon 2y agoRust already has several Flask equivalents (Actix, Axum, etc.) Rust is well on the way to having a Rails/Django.
- claudiojulio 2y agoSeriously? What's the project?
- echelon 2y agoThere are about a half dozen "Rails-inspired" Rust frameworks under development. They're probably a little too early to start using in production, and you should stick with Actix/Axum Flask-style frameworks for the time being. That said, here are a few examples: - https://loco.rs/ https://loco.rs/ - https://github.com/levkk/rwf https://github.com/levkk/rwf - https://tokio.rs/blog/2024-10-23-announcing-toasty https://tokio.rs/blog/2024-10-23-announcing-toasty (Tokio is beginning to assemble the pieces: Axum, Toasty, etc.)
- henning 2y agoThis isn't really an argument in favor of Rails so much as it is an argument against being indecisive and scattering your efforts too widely.
- wkirby 2y agoI spend a lot of time each year evaluating frameworks for our clients and their projects, and I keep on coming back to rails. > 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.
- sodapopcan 2y ago> and perhaps most importantly there's a "right" way to do just about everything your web application will ever need to do 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.”
- xp84 2y ago> It's typically caused by developers, not programming languages or frameworks. 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.
- randomdata 2y agoOf course, but the trouble remains what is stated in the very next sentence: > 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...
- Linell 2y agoDo you have any examples of why RoR is more time consuming to refactor than other languages?
- rapind 2y agoIMO rails is a victim of it's own success. By being incredibly productive and easy to get things up and running, you don't have to reason about your data design as much, meaning you are more likely (not guaranteed) to throw together a bunch of badly related garbage. 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.
- cpursley 2y agoThe problem was choosing Rust and SvelteKit over Elixir with LiveView (Phoenix) - especially coming from Rails where it’s an easy transition due to shared philosophy and even syntax to some degree. Rust is neat but complex and probably overkill for a web app. But yeah, in general - innovation tokens cost time vs what you already know.
- physicsguy 2y agoIf few people know Rust, then even fewer people know Elixir. That's a major concern for these types of projects, often.
- cpursley 2y agoLike I've commented maybe 100 times on hn, there's more people who want Elixir jobs than there are Elixir jobs - it's not a real problem. Probably same for Rust. Especially when AI makes it so much easier to get up to speed on a new project, framework, etc these days.
- deleted 2y ago[deleted]
- randomdata 2y agoNow there is a familiar tune! > 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-to-choose 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)
- brink 2y agoI've worked with Rails, I've worked with Phoenix, I've also built with Rust and Svelte. I'd choose Rust+Svelte every time. Much better experience. Rust's async is not nearly as bad as people make it out to be. 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.
- siliconc0w 2y agoI do think LLMs change the game a bit. Rails is nice because of the ecosystem and how magic and expressive it is but LLMs can generate and maintain a lot of the boilerplate while they're less good at debugging the magic when it is misbehaving. 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.
- systems_glitch 2y agoRails still gets the job done. That's what you get paid to do -- the job!
- make_it_sure 2y agoRails is having a comeback
- sigzero 2y agoDon't call it a comeback.
- stiltzkin 2y ago[dead]
- randomdata 2y agoMore accurately: Cost cutting is having a comeback. Rails was built for the last cost-cutting era, so it seems relevant again.
- gardenhedge 2y agoEvery year rails has a comeback and the next year it needs another one
- wvenable 2y agoNo, it's not. But it also hasn't gone away. The long tail of viable technologies is much longer than most developers realize. Technology shifts are almost generational.
- claudiojulio 2y ago[flagged]
- malkosta 2y agoToo bad you didn't choose Phoenix/Elixir. Give it a try, and never come back to Rails.
- mervz 2y agoTruth
- necessary 2y agoIt seemed to me like a lot of the value of Rails came from all the batteries that are included - would you say it’s the same for Phoenix/Elixir?
- jb3689 2y agoIf you are doing anything serious, then yes. OTP is a top tier framework for writing any sort of complex parallel/distributed processing. I’d pick OTP over ActiveJobWhatever any day. Elixir code is also easier to maintain at scale due to stronger packaging and typing. OTP’s application abstraction is genius.
- claudiojulio 2y agoForget Rails and embrace Sveltekit. All the magic of Rails can be achieved in any framework with LLMs.
- theflyinghorse 2y agoReally struggling to see how Sveltkit is a all similar to RoR. Sveltkit is just a frontend SSR framework lacking the rest of the goodies and patterns of a full stack framework. Sveltkit seems to be a next.js alternative but not a RoR alternative
- claudiojulio 2y agoSveltekit is not the same as Rails. It's an evolution. Plus, it's very easy to get any Rails functionality from NPM.
- nicce 2y ago> Plus, it's very easy to get any Rails functionality from NPM. 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.
- nop_slide 2y agoIt's not the same at all. I have a SvelteKit + FastAPI app that ironically I'm porting to Rails after rediscovering it. 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.
- sureglymop 2y agoOne minor thing I would add is that of very recently, the new svc utility can set up auth, database stuff, i18n and some other things when creating a new svelte kit project. I suggest trying it out, it's pretty cool.
- nop_slide 2y agoOver the last few months I evaluated django, laravel, and rails by doing their tutorials. 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. [0]: https://github.com/lorint/brick https://github.com/lorint/brick
- exdsq 2y ago> I was hoping to like django more since I'm a professional python dev This is my issue too!
- tryptophan 2y agoDjango honesty feels pretty outdated and behind these days. The webdev race has sort of left python behind.
- cutler 2y agoNot in the job market. Django to Rails on Indeed is about 3 to 1.
- 0xblinq 2y agoI used to work with Django 10 years ago, and I loved it. 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.
- Scarbutt 2y agoI couldn’t help but notice that he was working with two extremes, ruby and rust. A nice middle ground could have been nodejs with TS, with the advantage of using a single language throughout the project. While nodejs doesn’t have something like rails, its ecosystem is largely centered around building web applications.
- cjr 2y agoI'd say adonisjs[1] is the closest thing in TS land to rails. There's also sailsjs[2]. Neither are as trendy as nextjs/sveltekit etc, but those are not really comparable to rails. [1]: https://adonisjs.com https://adonisjs.com [2]: https://sailsjs.com https://sailsjs.com
- hfourm 2y agoWhat about Rails and Svelte? While many people are doing things with full stack Rails, there are just as many using Rails (whether as a monolith or separate backend from frontend deployments) with modern JS. 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?
- richardlblair 2y agoTbh, if you're already using rails the odds that you'll need svelte / react are pretty low. Sometimes you might, and those pages can pull those in, but generally speaking you can do a lot with Turbo and Stimulus.
- RangerScience 2y agoThere’s actually a couple really good ways to embed React in a Rails template. Let’s you have something really interactive when you need it.
- hfourm 2y agoI mean, it just totally depends on the application. It does add complexity, sure. 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.
- very_good_man 2y agoExcellent article. This is why I have tied my livelihood to Ruby on Rails.
- galaxyLogic 2y agoRewriting really improves the quality of the code-base, because it increases our understanding of it, and allows us to replace stupid designs with better ones. Using adifferent language or platform forces you to rewrite much of it, with the same or better design. In my opinion the ionvestment is not so much in the code, than in the design.
- deleted 2y ago[deleted]
- agentultra 2y agoI'm not surprised that this conclusion was reached after trying to use Rust for a web development project. 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.
- deleted 2y ago[deleted]