
Welcome to Practical Sorbet! We'll look at what you can expect from this course and what I recommend you know going in.
Before setting up Sorbet on an existing project, let’s look at Sorbet’s gradual approach to adding a type system to a Ruby codebase.
To start our Sorbet journey, let's see how easy it is to incorporate the Sorbet typechecker in an existing project. We'll use the well-known Ruby Money gem and see how even code written without typechecking in mind from the beginning can utilize Sorbet.
We've seen how easy it is to add Sorbet to an existing project. But how does Sorbet understand what constants and methods are available from gems and meta-programmed code? Let's see how RBI (Ruby Interface) files can help Sorbet typecheck the more dynamic features of Ruby and how Tapioca aids us with RBI generation.
We've seen how Sorbet can help us in our development workflow to typecheck our code. Next, let's look at Sorbet's runtime tools to help aid in type-safe code design and eliminate common guards we write in Ruby.
Understanding the five strictness levels that can be used for typechecking your Ruby files is essential for adopting Sorbet. Let's examine each option and discuss when and why you should use them.
One of the most essential features of Sorbet is the ability to add runtime type signatures to your Ruby code. These are powerful for communicating type information to callers of your code, failing loudly when a type error occurs, all while being pure Ruby!
We've seen a brief example of the T::Enum and T::Struct classes that Sorbet provides. Let's take a closer look at the power of these classes and a few examples of leveraging them to improve our Ruby code.
Sorbet offers us a few options for type assertions and escape hatches during the runtime of our code to give the type system information we know as developers that it can't necessarily figure out. Let's examine some options and discuss when and how you should use them.
One question I often get from teams adopting Sorbet is how to use it in their test suites. Let's examine how Sorbet works with RSpec and Minitest and discuss whether you should consider type-checking in your test suite.
Even teams that have used Sorbet for a while run into head-scratching issues now and then. Let's look at a few options you have when you get stuck.
We've seen the power and type-safety we get with Sorbet. Now let's talk about the realistic steps you can take to adopt it in your organization.
The Sorbet type checker from Stripe has grown in popularity among Ruby development organizations in recent years due to its gradual nature and the number of bugs it can eliminate. Type guarantees have traditionally seemed impossible in the Ruby language, but Sorbet has provided a great solution. Getting started can be difficult for some teams, though. In this course, we'll learn everything you need to know to introduce Sorbet to new or existing projects, understand the best way to write type signatures and use other features of Sorbet and see how to improve your development workflow with a typechecking step.
You'll see how to get started with Sorbet in any Ruby codebase in less than 30 minutes. Then, we'll explore various aspects of Sorbet in depth and how they all work together to provide type safety to your code. By the end of this course, you'll have tools to update your development workflow with typechecking and learn how to approach adopting Sorbet on any team composition or code organization strategy. Sorbet works equally great for small and large repositories alike.
Small Ruby consultancies and large Ruby organizations such as Stripe and Shopify all ship code confidently with Sorbet. Discover how easy it is for your team to start doing the same!