nayaread
HomeFavouritesTopicsSources
HomeFavouritesTopicsSources
NayaRead links to original engineering blogs. All copyright belongs to the respective authors.
Shopify Engineering·Dec 7, 2020·9 min read45

The State of Ruby Static Typing at Shopify - Shopify

Shopify changes a lot. We merge around 400 commits to the main branch daily and deploy a new version of our core monolith 40 times a day. The Monolith is also big: 37,000 Ruby files, 622,000 methods, more than 2,000,000 calls. At this scale with a dynamic language, even with the most rigorous review process and over 150,000 automated tests, it’s a challenge to ensure everything works properly. Developers benefit from a short feedback loop to ensure the stability of our monolith for our merchants. Since 2018, our Ruby Infrastructure team has looked at ways to make the development process safer, faster, and more enjoyable for Ruby developers. While Ruby is different from other languages and brings amazing features allowing Shopify to be what it is today, we felt there was a feature from other languages missing: static typing. Shipit! Presents: The State of Ruby Static Typing at Shopify On November 25, 2020, Shipit!, our monthly event series, presented The State of Ruby Static Typing at Shopify. Alexandre Terrasa and I talked about the history of static typing at Shopify and our adoption of Sorbet. We weren't able to answer all the questions during the event, so we've included answers to them below. What are some challenges with adopting Sorbet? What was some code you could not type? So far most of our problems are in modules that use ActiveSupport::Concern (many layers deep, even) and modules that assume they will be included in a certain kind of class, but have no way of making that explicit. For example, a module that assumes it will be included in an ActiveRecord model could be calling before_save to add a hook, but Sorbet would have no idea where before_save is defined. We are also looking to make those kinds of dependencies between modules and include sites explicit in Sorbet. Inclusion requirements is also something we’re trying to fix right now, mostly for our helpers. The problem is explained in the description of this

ArchitectureTypeScript
Read original on shopify.engineering

Discussion around the web

  • Hacker News4 · 0 💬

Score breakdown

  • Technical depth82
  • Practical value30
  • Originality60
  • Writing quality100
  • Source reputation0
  • Recency0
  • External engagement8
  • On-site engagement0

NayaRead shows a summary and links to the original article. The full article is hosted on shopify.engineering.

More like this

Shopify Engineering

Shopify-Made Patterns in Our Rails Apps - Shopify

Jul 13, 2021·10 min read
Shopify Engineering

Writing Better, Type-safe Code with Sorbet - Shopify

Jun 24, 2020·8 min read
Shopify Engineering

Static Typing for Ruby - Shopify

Nov 19, 2020·12 min read
Shopify Engineering

A Packwerk Retrospective - Shopify

Feb 7, 2024·17 min read