4 ms·
(Disclaimer: I work at Stripe and use Sorbet) IMO the Sorbet additions do impact readability, but it dramatically improves understandability. In a codebase pas
by feifan 5y ago
(Disclaimer: I work at Stripe and use Sorbet)
IMO the Sorbet additions do impact readability, but it dramatically improves understandability. In a codebase past a certain size/number of contributors, you're always going to have ambiguity about what sort of data you're working with. For example, in my part of the codebase we have models representing an entity that is identified by a number in external systems and represented as a whole data object in our code. If I have `foo.entity`, it's unclear just from the "real" code whether that'll return a data object or just the numerical identifier. Having the Sorbet annotations on that method (and available on hover in the IDE) make it a lot easier to navigate the codebase and resolve these ambiguities.
- cardy31 5y agoI agree with this take. I work at Shopify using Sorbet and Rails. On a monolithic code base it can be very helpful to know what type is going to be returned. On a smaller code base I may not bother with it for the reasons the original commenter mentioned.
- joelbluminator 5y agoDoes it still feel like Ruby though or is it a new beast? I mean Typescript doesn't really look like Javascript at all and your whole mindset changes when you use it. So is Shopify now typing the whole monolith ?
- rattray 5y agoIf you don't like TypeScript, you probably won't like Sorbet, but Sorbet does not extend ruby's syntax at all.
- jez 5y agoYep, Shopify another huge user of Sorbet. They’ve been using it since before it was open sourced, and have spoken about their experiences: https://youtu.be/v9oYeSZGkUw https://youtu.be/v9oYeSZGkUw The numbers and testimonials in that presentation are two years old at this point but I can only think that means they’ve improved since then.
- feifan 5y agoIMO it depends on what part of the ruby feel you most enjoy. Sorbet makes it harder to work with the runtime-magic parts of Ruby (and in some cases we rely on tooling-generated code instead of runtime dynamic stuff), but it doesn’t affect the code you’d write within methods all that much.