Experiment: Fully adding Sorbet and RBS to a small project

02-Nov-2023 927
To get a better understanding of the value of gradual typing in Ruby projects I picked a small completely finished side project and did 3 experiments:Adding Sorbet at strict level to all files without metaprogramming.Adding RBS annotations to all files and Running Steep on strict setting.Adding Simplecov and raising line and branch test coverage to maximum.Here is what I learned:Both Sorbet and RBS found the same two bugs with RBS uncovering one extra small issue.Raising test coverage to maximum uncovered more bugs and more small issues than typing, including both bugs that gradual typing found.Sorbet feels like a more polished project, probably becasue some of the largest Ruby companies are using it. This is most noticeable in its excellent documentation.Both typing approaches were most painful around the (relatively light) meta-programming used in the project. Raising test coverage with Simplecov unsurprisingly had no issues there.
Use coupon code:

RUBYONRAILS

to get 30% discount on our bundle!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these highly-rated books offer thousands of essential questions and answers to boost your interview success. Buy our 'Ultimate Job Interview Preparation eBook Bundle' featuring 2200+ questions across multiple languages. Ultimate Job Interview Preparation eBook Bundle