News for hackers. Stuff that matters.
Re:An Overview of Ruby on Rails 7.1 Features. Part III by siaw23 on Monday January 23, 2023 @04:06PM (#34495031)
Rails has matured through the years, I'm convinced it's the right framework for any project if you already know it, you can get by with Hotwire for the FE and not run after React and the rest. Happy to be a Rails dev to be honest.
Re:An Overview of Ruby on Rails 7.1 Features. Part III by jemmyw on Monday January 23, 2023 @04:20PM (#34495241)
It's good with React too when you need more interactivity.
Re:An Overview of Ruby on Rails 7.1 Features. Part III by siaw23 on Monday January 23, 2023 @04:39PM (#34495451)
I believe you can do anything React can with Stimulus + Turbo these days. I don't do much FE but I've been tracking Hotwire for some time now.
Re:An Overview of Ruby on Rails 7.1 Features. Part III by sharps_xp on Monday January 23, 2023 @05:17PM (#34495906)
perhaps for most things but probably not to the extent of something like excalidraw, which uses react
Re:An Overview of Ruby on Rails 7.1 Features. Part III by splitrocket on Monday January 23, 2023 @05:24PM (#34495966)
Yes, but in that case, you can use only the complexity where you need it, instead of globally.
Re:An Overview of Ruby on Rails 7.1 Features. Part III by mokkol on Wednesday January 25, 2023 @02:44PM (#34523168)
You can still use React or whatever on those pages. And for the rest (settings pages, signup pages and all the CRUD pages) you can use standard Rails with Hotwire.
Re:An Overview of Ruby on Rails 7.1 Features. Part III by simpsond on Monday January 23, 2023 @06:24PM (#34496565)
Yes, but there is a whole ecosystem of react components and react developers.
Re:An Overview of Ruby on Rails 7.1 Features. Part III by jacobsenscott on Monday January 23, 2023 @06:37PM (#34496731)
Maybe you can with heroic effort, but you shouldn't. You should build within the constraints of your tools. HW + Stimulus are great - good enough for what most web apps need to do. It gives you "traditional web app, with a bit of realtime updating" - which is the perfect fit for most web apps.

But you wouldn't want to use it for a fully interactive desktop style application with lots of interacting components.

Re:An Overview of Ruby on Rails 7.1 Features. Part III by 0xblinq on Wednesday January 25, 2023 @02:20PM (#34522878)
Agree. So unless you have a pretty big budget and you're building Google Maps or Figma you shouldn't use React.

Sadly, everyone things they have such a big budget and they're building the next Figma. Even if you're building a CRUD app. (I'm talking to you previous team of mine).

Re:An Overview of Ruby on Rails 7.1 Features. Part III by jemmyw on Monday January 23, 2023 @07:55PM (#34497532)
You can do anything with plain JS too, but that doesn't mean you'd want to. The problem with Hotwire is that you do often have the server round trip in there. That's fine most of the time, it just gets a little harder to understand as the complexity rises. That's not to knock it, I think Hotwire is pretty good.
Re:An Overview of Ruby on Rails 7.1 Features. Part III by andrei_says_ on Monday January 23, 2023 @08:37PM (#34497907)
In what scenario would complexity be higher in a simple UI - server loop? Doesn’t complexity usually arise from having additional logic in the browser and maintaining state separately?
Re:An Overview of Ruby on Rails 7.1 Features. Part III by jemmyw on Tuesday January 24, 2023 @08:11PM (#34513007)
I guess it depends somewhat on how you imagine up something and write it. I was working on some drag and drop UI that had multiple sortable lists and an action area. Figuring the server side and UI at the same time didn't work out. I reversed and implemented the UI with its required state, and then it was easy to transform that state to what the server side required, and vice versa.

Complexity is tricky. Are three simple things more complex than one thing thats harder to understand?

Re:An Overview of Ruby on Rails 7.1 Features. Part III by granshaw on Wednesday January 25, 2023 @05:11PM (#34524872)
Still decent amount of caveats given the UX expectations of 2023... eg last I checked there was no official support for transition animations
Re:An Overview of Ruby on Rails 7.1 Features. Part III by Gigachad on Monday January 23, 2023 @05:27PM (#34495995)
Rails is extremely easy to get started with but after a few years the lack of types on Ruby cripples every single Rails app I've ever worked on. You can have as many unit tests and browser automation tests as possible, but updating any gem is a dice roll despite doing as much due diligence possible. And it's always something extremely trivial like a method changing its parameters without announcing it in the change log for some reason. Something almost any other language would warn you about.

I've been doing Rails dev for 7 years now but I just don't see it winning over TypeScript/nodejs frameworks. The only advantage Rails still holds is the out of the box batteries included package. But once a TS framework gets this, Rails will be in decline.

Re:An Overview of Ruby on Rails 7.1 Features. Part III by favorited on Monday January 23, 2023 @06:03PM (#34496355)
Doesn't Ruby have 2 production-ready typecheckers now? I think Ruby officially has something called RBS, and Stripe open-sourced Sorbet.
Re:An Overview of Ruby on Rails 7.1 Features. Part III by Gigachad on Monday January 23, 2023 @06:04PM (#34496375)
We evaluated them, it's just not there and it's unclear if it ever will be. DHH, the lead for the Rails project has indicated that Rails will "absolutely not" have a type checker in reply to a tweet asking about it. And a huge amount of work would be required from the Rails team to get type checking to work.
Re:An Overview of Ruby on Rails 7.1 Features. Part III by klardotsh on Monday January 23, 2023 @07:23PM (#34497220)
Used to work at a Rails shop, and led an effort to get type safety into the codebase. It was a nightmare that wasted endless time and added plenty of stress.

Sorbet is great on vanilla Ruby code that doesn't try to use too much arcane metaprogramming. It's "okay" on vanilla Ruby code that uses some arcane metaprogramming that humans can reliably reflect in RBS files. In a Rails codebase, which is (IMO) a huge ball of relatively hard to statically analyze magic and quite heavily uses all sorts of tricks for either API ergonomics/skimmability or for performance, it was a mess, and frankly, I had a pretty nightmarish time selling almost any of the feature set beyond (1) ADTs/Enums (2) the subset of Interfaces as exposed by `T::Struct`.

Sorbet is a herculean effort by some extremely talented devs. I don't at all want to discredit that. Tapioca is likewise an impressive DSL-reflection machine on top of RBS files, particularly post-0.8 release. But type safety in a Rails app is, at least in my experience, extremely high cost both upfront and maintenance.

Re:An Overview of Ruby on Rails 7.1 Features. Part III by ywain on Monday January 23, 2023 @08:32PM (#34497872)
To offer another point of view: I work on a recent Rails app that was set up with Sorbet/Tapioca from the get-go. All Ruby code is `# typed: strict`, and we (I) feel like the ROI is generally positive. It's caught more than one bug, and it's easy to eject from it when it gets in your way.

That said, type safety via Sorbet/Tapioca is ultimately an afterthought in Ruby and the DX suffers from it compared to languages where type safety is baked in. In my limited experience, MyPy in Python was even worse though.

As for RBS, I have literally never seen it used in the wild and I don't know why the Ruby core team bothers with it rather than go all-in on Sorbet.

Re:An Overview of Ruby on Rails 7.1 Features. Part III by klardotsh on Monday January 23, 2023 @11:16PM (#34499171)
(your comment made me realized I kept typing "RBS" when I meant "RBI" in a Sorbet context. oops)

Anyway, I did have my strong suspicions that Sorbet would pay off more in a codebase that used it from Day 1. Glad to hear at least one report that indeed, that was the case.

Re:An Overview of Ruby on Rails 7.1 Features. Part III by Fire-Dragon-DoL on Wednesday January 25, 2023 @01:59AM (#34515250)
They are terrible. Typescript might have spoiled me, but the type system is bad and the type checkers are even worse.
Re:An Overview of Ruby on Rails 7.1 Features. Part III by mplewis on Monday January 23, 2023 @06:08PM (#34496417)
This is exactly why I’m keeping my eye on RedwoodJS. They are coming for the crown.
Re:An Overview of Ruby on Rails 7.1 Features. Part III by 0xblinq on Wednesday January 25, 2023 @02:18PM (#34522857)
Same thing that other people sat about Next.js, about Remix, Nest, Qwik, and the other 10 thousand that "are coming for the crown". In fact, that's the problem.
Re:An Overview of Ruby on Rails 7.1 Features. Part III by brightball on Tuesday January 24, 2023 @09:02AM (#34503628)
I've worked with a lot of Rails code bases over the last 10 years and just haven't ever experienced this problem from a types perspective.

Certainly, if you let gems start to get out of date the dependency chains to get them updated can become a task but that's fairly true of any language. It's one of the selling points for moving parts of an app to isolated services too.

Everything is a tradeoff though. I don't know that you can get the Aspect Oriented Programming gains that you get with Ruby and Rails with a more strictly typed language.

Re:An Overview of Ruby on Rails 7.1 Features. Part III by Fire-Dragon-DoL on Wednesday January 25, 2023 @01:57AM (#34515242)
Every Rails upgrade is kinda proof of the problem, isn't it?

There is an entire market on Google of companies expert in upgrading Rails, that to me is a bad signal.

(notice, I have almost 15 years of experience with rails)

Re:An Overview of Ruby on Rails 7.1 Features. Part III by brightball on Wednesday January 25, 2023 @09:22AM (#34518530)
During the Ruby 1.8.7 to 1.9 transition there was a lot of complexity to things, but it hasn't really been a big problem since then has it?
Re:An Overview of Ruby on Rails 7.1 Features. Part III by Fire-Dragon-DoL on Wednesday January 25, 2023 @11:17AM (#34520125)
I dodged that, started getting serious with rails 3 and ruby 1.9+

No,there are still many undocumented breaking changes. I recently upgraded an old app from Rail 4 to 7 that used minimal non-rails stuff and was shocked by the corner cases.

Manu changes to activerecord api go completely undocumented, but they break the code nonetheless

Re:An Overview of Ruby on Rails 7.1 Features. Part III by brightball on Wednesday January 25, 2023 @10:09PM (#34527276)
Did you go straight from 4 to 7 or 4, 5, 6, 7?
Re:An Overview of Ruby on Rails 7.1 Features. Part III by Fire-Dragon-DoL on Thursday January 26, 2023 @07:20AM (#34530799)
There is no upgrade guide from 4 to 7,so I did from 4.2 to 5,from 5 to 5.1, from 6 to 6.1 and then to 7.

I actually found a bug that broke my app at version 6 that was resolved in 6.1,so technically my tests were not passing in version 6 and I did an "unsafe upgrade" to version 6.1

Re:An Overview of Ruby on Rails 7.1 Features. Part III by 0xblinq on Wednesday January 25, 2023 @02:15PM (#34522818)
> Rails dev for 7 years now but I just don't see it winning over TypeScript/nodejs frameworks

I think you're comparing a language/runtime with a framework here. I also prefer Node and JavaScript over Ruby but I get what you say, and I agree.

I think Adonisjs ticks all the boxes to be that framework in the future. It just doesn't have the community it needs to be 100% successful yet... with more adoption it will get all the missing features, documentation and little annoyances it might have today polished.

But something I'm worried about is if that the fragmentation is just too big at this point. I don't see people agreeing on a single "full stack" framework as it happened in other environments.

I think this happens because most other "big frameworks" were born when there were not that much competition and not that many people on their ecosystems, so there were a lot fewer options and people concentrated around those frameworks and made them grow to what they are today (Laravel, Rails, Django, Spring...).

The "backend JavaScript" ecosystem is a freaking mess. So many competing options, all of them terribly incomplete, all of them claiming to be "full stack" just because they can execute JavaScript on the server... yes, maybe "full stack" but without the battery... it's a lamborghini that you have to put together yourself before being able to use it.