A Journey Through the Sorbet Pipeline, by Emily Samp

Abstract

Ruby is widely known as a dynamic programming language that encourages practices like duck typing and metaprogramming. While this can give programmers a lot of flexibility, it can also make programs hard to reason about and debug.

Enter Sorbet: a gradual type checker for Ruby. Using Sorbet, we can harness the flexibility and creativity of a dynamic language while benefiting from the safety of typing.

In this talk, we'll learn what Sorbet is and how it works. Together, we'll go on a journey through the Sorbet pipeline, exploring the steps Sorbet takes to add types to our Ruby code.

Details

Intended Audience

This talk is intended for any Ruby developer who is curious about Sorbet. While this talk will have a technical focus, concepts will be explained from the ground up, making it approachable for junior developers while still providing valuable content for those who are more experienced.

Outcomes

By the end of this talk, the audience should be able to answer the following questions:

  • What is Sorbet?
  • Why would someone want to type check Ruby code?
  • At a high level, how does Sorbet work and how is it implemented?

Outlines

  1. Introduction [5 minutes]
    • Introduce speaker
    • Introduce the concept of type checking: what problems does it solve?
    • Introduce Sorbet, which is a gradual type checker for Ruby
    • Note: define the term "gradual type checker"
    • Explain how Sorbet is added to a codebase and what problems it can solve
  2. Sorbet implementation and architecture [20 minutes]
    • This section will be structured around taking a code snippet and showing how Sorbet processes it in order to gain information about types
    • This is where we'll take a "journey" through the Sorbet pipeline:
    • Parse: converts Ruby code into "nodes" -- we're now working with code that represents code!
    • Desugar: converts those nodes to simpler representations of themselves
    • Rewrite: converts nodes into simpler "expressions"
      • Has multiple sub-steps; explain what each of these sub-steps does
    • CFG: Converts expressions into a control-flow graph
    • Infer: From the CFG, infers information about types
  3. Sorbet at Shopify [3 minutes]
    • At Shopify, we have four years of historical data about our Sorbet usage
    • This section will dive into how we use Sorbet "at scale" and how it has changed our development workflows
    • This is not a pitch -- there are some positives here and some drawbacks
  4. Conclusion [2 minutes]
    • Recap the important takeaways
    • Ask the audience to consider whether Sorbet might be a good tool for their projects

Pitch

Over the past year, I have worked at Shopify on the Ruby Developer Experience Team, where I help other teams improve their development workflows using tools like Sorbet. While Sorbet has existed for a while, it is still not widely used, and many people are curious about what it is and how it works. I want to take the opportunity to educate the broader community about Sorbet while also growing my own technical knowledge and expertise.

I am an experienced speaker with a track record of breaking down difficult topics into understandable concepts, so I think I would be an ideal candidate for giving a technical talk that is still accessible to a wider audience of Ruby developers.

Edit proposal

Submissions

Blue Ridge Ruby 2023 - Accepted [Edit]

Add submission