Gradual Types and Type Checking for the Ruby Programming Language

The engineering team at Stripe, an online payment processor, has been cooking up something awesome for the Ruby programming language. They have been hard at work on Sorbet, a type checker for Ruby so that they can keep developing software quickly while also reducing the amount of bugs in their code. The Stripe code base has many millions of lines of code and as they keep building new features and fixing bugs, they have to make sure they are not breaking something else in that vast code base.

Stripe has invested in better programming tools like the Sorbet type checker because it is insurance: they can add new features and avoid breaking things for customers and avoid losing business.

If you are a Ruby or Ruby on Rails developer or software engineer, you can check out an online example of the Ruby type checker Sorbet:

What is type checking? Type checking establishes that at particular points in a program, the variables involved and the operations conducted on those variables match the types. For instance, when adding two numbers like this “a + b”, the values for a and b have to be numbers. But what if the value of a or b was something else that isn’t a number. Something like “hello + 4” will crash the program when the program is run. However, if you use type checking, you will be warned about problems like that earlier.

What are the advantages of type checking for development? The idea of type checking is that it makes maintenance and refactoring easier, and it should lower the cost of development. Without type checking, developers will usually write many more unit tests to make sure programs are using the right types of objects when the programs are run. With type checking, developers will be able to write fewer unit tests which saves time and lowers development costs. Type checking also increases the confidence within the code base, making it easier for developers to fix bugs and, importantly, to add new features.

What is the Ruby programming language? Ruby is the programming language behind the popular Ruby on Rails framework. It is a dynamically typed language with a lot of cool features that significantly speed up develop and make rapid prototyping and development possible (especially in comparison to languages such as Java and C/C++).

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.