, 9 tweets, 2 min read Read on Twitter
Stripe has open sourced Sorbet, our Ruby type checker: sorbet.org/blog/2019/06/2…

I will probably adopt this in all future Ruby projects. Here’s why:
Sorbet is *fast*.

One of the best properties of golang is that type checking and formatting are fast enough to run basically on every key stroke, so that you get instant feedback on errors and, once the errors are gone, a small unit of development is likely correct.
Ruby test suites, particularly in large projects, do not execute fast enough to use them in this feedback loop. Sorbet type checking does. If you have forgotten that an internal service expects a User not their email address you’ll learn that about the same time you close the )
Sorbet is, unlike most language-level type systems, designed for the reality that the supermajority of your Ruby code (including that inherited from the ecosystem) is untyped.

You can upgrade-in-place a project gradually to create a typed core. This has felt enormously powerful.
One, most projects that I’ve worked on do have a core where correctness is very important, reasoning about what the code is doing is the majority of the effort, and changes are made with care.

That core is often fuzzily defined.
The mechanics you’ll need to type check the core will generally force it to have good interfaces, something which Ruby does not encourage by default. You’ll find it’s easier to type check if you refactor sanely; the code will *get better* as you do this.
Two, optional type checking lets you continue using, or drop into using, untyped code in places where you’re just doing trivial string munging and where typechecking generally provides relatively little value.

(Thin controllers and views, in my experience, don’t need much.)
Type checking catches bugs that unit testing does not, often much faster and with less code overhead than unit testing requires. It has surprised me how much of my unit tests were de facto implementing a type system halfheartedly as opposed to testing behavior of those types.
My enthusiasm for this project is extremely high; it’s perceptibly the best upgrade to writing Ruby code I’ve experienced since starting with Ruby in 2008.

We are quite invested in Ruby. If you’d also like working on this: stripe.com/jobs
Missing some Tweet in this thread?
You can try to force a refresh.

Like this thread? Get email updates or save it to PDF!

Subscribe to Patrick McKenzie
Profile picture

Get real-time email alerts when new unrolls are available from this author!

This content may be removed anytime!

Twitter may remove this content at anytime, convert it as a PDF, save and print for later use!

Try unrolling a thread yourself!

how to unroll video

1) Follow Thread Reader App on Twitter so you can easily mention us!

2) Go to a Twitter thread (series of Tweets by the same owner) and mention us with a keyword "unroll" @threadreaderapp unroll

You can practice here first or read more on our help page!

Follow Us on Twitter!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just three indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!