News for hackers. Stuff that matters.
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by brink on Tuesday December 20, 2022 @10:33AM (#34067279)
> What's the general vibe on RoR nowadays?

Most people that use it are fine and productive.

Because of lazy evaluation, type issues persist though. Plenty of instances of trying to call string methods on integers, and array methods on nil, and Rails devs in denial that that's a big problem as the app continues to grow.

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by randomdata on Tuesday December 20, 2022 @10:45AM (#34067468)
Because of lazy evaluation or because the developers aren't properly documenting their work? A language with a formal type system essentially forces you to provide type documentation, but there is an expectation with dynamically typed languages that you will still document the types (probably in your test suite). Rails in particular makes this a core function of the framework to really push you to do so.
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by pmontra on Tuesday December 20, 2022 @10:52AM (#34067577)
> Rails in particular makes this a core function of the framework to really push you to do so.

This sentence surprised me. How does Rails do it?

I never documented types in Rails and all was well, since 2005.

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by randomdata on Tuesday December 20, 2022 @11:01AM (#34067742)
Rails puts testing front and centre. Testing exists to document how features are intended to function and intended to be used (with the added bonus of enabling machine validation of the documentation).

If a function accepts an arbitrary type, as is the case for all inputs in a dynamic language, one needs to document how the function is expected to behave when given x type. This is ultimately the same as type checking in a typed language. It just moves where the documentation is located.

In that move, it is true that you often lose some strictness in the quality of the documentation. The developers who have an active hatred towards their co-workers may even forgo writing documentation entirely. But if you reach that point you've really got people problems, not technical problems.

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by endlessvoid94 on Tuesday December 20, 2022 @10:51AM (#34067560)
I don't think it's denial - I've worked on a ton of rails apps of all different sizes and scales and...I've gotta say, I just don't see the issues you name in production all that often.

It's a problem, but it's not a big problem.

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by wiseowise on Tuesday December 20, 2022 @01:36PM (#34070190)
It’s not a big problem until it is.
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by pizza234 on Tuesday December 20, 2022 @10:52AM (#34067575)
> Because of lazy evaluation, type issues persist though. Plenty of instances of trying to call string methods on integers, and array methods on nil, and Rails devs in denial that that's a big problem as the app continues to grow.

This is not anymore inherent in the language. Gradual typing support for Ruby is now reasonably mature (companies like Shopify with large codebases have adopted it), so it's up to the team do decide if they want to take advantage of it or not.

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by flippinburgers on Tuesday December 20, 2022 @11:01AM (#34067736)
The main problem is active record insanity and poorly designed table relationships/indices that lead to maintenance nightmares.
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by fknorangesite on Tuesday December 20, 2022 @11:53AM (#34068572)
> poorly designed table relationships/indices that lead to maintenance nightmares.

Like what?

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by theonething on Tuesday December 20, 2022 @12:38PM (#34069277)
> active record insanity

What exactly do you mean by that? It's just a bad ORM all around or is there something specific that is insane about it?

> poorly designed table relationships/indices

What does that have to do with Rails? Poorly designed databases are the fault of the developer(s) who designed them.

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by Alifatisk on Tuesday December 20, 2022 @11:46AM (#34068451)
I have to agree on this one, it feels like some people are in denial of type issues within the Ruby / Rails community.

I've been experimenting with Rbs, Sorbet & Contracts though, they have their potential.

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by gosukiwi on Tuesday December 20, 2022 @12:32PM (#34069178)
To be fair most of typing problems in Rails can be solved by having contracts and an operation pattern, kind of like Trailblazer, although they went a little bit too far lol
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by oleg_antonyan on Tuesday December 20, 2022 @12:48PM (#34069438)
The UX is terrible. Separate file for types is just inconvenient. I wish it was something like Python's optional typing
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by Alifatisk on Tuesday December 20, 2022 @02:19PM (#34070969)
Optional typing in Ruby would be so awesome
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by jack_riminton on Tuesday December 20, 2022 @12:17PM (#34068933)
For what it's worth I've been working with Rails projects for over 7-8 years and I've never encountered this as a problem
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by oleg_antonyan on Tuesday December 20, 2022 @12:46PM (#34069389)
I use type assertions for this https://github.com/olegantonyan/typerb
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by randito on Tuesday December 20, 2022 @02:03PM (#34070673)
> and Rails devs in denial that that's a big problem as the app continues to grow.

As someone who maintains Rails 3 apps ad infinitum, this is where things break down with Rails applications. You can create applications very quickly with Rails if you stay within the conventions. But as the app grows, that discipline breaks down and the structure starts to suffer.

This is true for a lot of web applications. But I think the problem is worse for Rails because it's so easy to get started and create apps. That ease comes back to bite you -- as a giant legacy Rails app that no one on the team understands and no one is interested in fixing or maintaining.

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by multiplegeorges on Tuesday December 20, 2022 @04:56PM (#34073240)
I've just added Sorbet and Tapioca to a Rails project and I was pleasantly surprised to find out that it works very well now!

As I add type annotations to my methods, VS Code and Sorbet are giving me similar feedback to what I get from Typescript projects.