BlogsShopifyDevelopment Methodologies and Practices

Development Methodologies and Practices

Development Methodologies and Practices

10
posts
2010–2022

Shopify has evolved its engineering practices by emphasizing techniques that minimize code reading and maximize reliance on automated checks like the type system and linters. This includes strategies for finding entry points, making initial breaking changes, climbing the callstack with build errors, and updating recommended code during the downswing. The focus is on codifying standards in linters, leveraging the type system for stricter argument validation and exhaustive switches, and optimizing unit tests for clarity and maintainability. The ultimate goal is to improve developer efficiency and reduce the cognitive load associated with code maintenance.

2022

How to Write Code Without Having to Read It - Shopify

10/11/2022

This post introduces a methodology for writing and editing code with minimal reading by leveraging build errors and the type system. It details strategies for finding code entry points by searching for user-visible strings, making initial breaking changes to trigger build errors, and climbing the callstack to resolve these errors. It also outlines how to update recommended code during the 'downswing' by relying on linters, type system enforcement (e.g., tagged unions, exhaustive switches), and unit test failures. The post advocates for codifying important checks in linters and the type system rather than relying on comments.

2021

Other Driven Developments - Shopify

5/21/2021

This post introduces and elaborates on 'Grep Driven Development' and 'Copy/Paste Driven Development' as valuable, albeit often overlooked, development methodologies. It argues for the importance of consistent naming conventions to enhance code searchability and refactorability, drawing parallels to the 'rule of three' for abstraction. It also advocates for a mindful approach to copy-pasting, emphasizing its efficiency, the humility it requires, and the skill set it demands, particularly in writing copy-pasteable code and understanding edge cases. The post frames these as deliberate practices that, when applied thoughtfully, contribute to better engineering outcomes.

How to Build a Web App with and without Rails Libraries - Shopify

3/26/2021

This post details the fundamental concepts of building a web application from scratch using core Ruby libraries, covering network protocols (TCP and HTTP), persistent data stores, and the web server interface (Rack). It then demonstrates how these concepts are abstracted and implemented by Rails libraries like Action Controller, Action Dispatch, Active Record, and Action View, providing a comparative analysis of building with and without Rails.

4 Tips for Shipping Data Products Fast - Shopify

3/2/2021

This post introduces four key strategies for accelerating the delivery of data products: 1. Utilizing design sprints to focus team efforts and establish clear timelines. 2. Emphasizing rapid prototyping, particularly with spreadsheets, to enable quick learning cycles and avoid sunk costs. 3. Recommending the avoidance of complex machine learning in initial iterations, favoring simpler models to validate product effectiveness first. 4. Stressing the importance of continuous user feedback through specific questions and diverse user groups to ensure the right product is built.

2020

The State of Ruby Static Typing at Shopify - Shopify

12/7/2020

This post details Shopify's adoption and experience with Sorbet for static typing in Ruby. It covers challenges encountered, such as typing modules with `ActiveSupport::Concern` and modules with implicit inclusion requirements. It explains how Sorbet handles array types and complex nested structures. A comparison is drawn between Sorbet for Ruby and TypeScript for JavaScript, highlighting differences in dynamism, maturity, and runtime checking. The post also discusses the relationship between Sorbet, RBS, and Tapioca, and provides guidance on starting with Sorbet in a Rails project, including which files to check in and how to gradually adopt typing.

Static Typing for Ruby - Shopify

11/19/2020

This post details the adoption of Sorbet for static typing in Ruby at Shopify. It outlines the three key requirements for a typing solution (gradual typing, speed, full Ruby support) and explains why Sorbet was chosen. The post describes the process of treating static typing as a product, including testing viability, creating RBI files, and tracking adoption using SorbetMetrics. It also covers the evolution of developer support and the use of surveys and interviews to measure developer happiness. The current state of Sorbet adoption in the monolith is presented.

Writing Better, Type-safe Code with Sorbet - Shopify

6/24/2020

This post details the adoption of Sorbet for static type checking in Ruby, focusing on its benefits for type-safe method calls, complex data types, and polymorphism. It explains how Sorbet helps catch errors that unit tests might miss by enforcing method signatures, defining typed structs for data, and using interfaces for dependency injection. The post also highlights Sorbet's support for gradual refactoring, allowing for file-by-file adoption and different strictness levels.

2019

Make Great Decisions Quickly with TOMASP - Shopify

10/22/2019

Introduces TOMASP (Timebox, Options, Meta-decision, Analyze, Step back, Prepare to be wrong) as a framework for making better, faster, and more consistent decisions, particularly for high-impact technical choices. It emphasizes counteracting cognitive biases and uncertainty by structuring the decision-making process.

2012

RESTful thinking considered harmful - followup - Shopify

3/31/2012

This post clarifies the author's previous arguments about RESTful thinking, emphasizing that the primary concern is the intuitive design of applications, particularly for new developers, rather than a strict adherence to REST semantics. It highlights the potential for developers to misuse Rails' RESTful conventions (e.g., abusing the `update` action for state transitions) leading to data loss. The author suggests that Rails should integrate state machine implementations and that educational materials should prioritize teaching state machines for complex operations, with RESTful API design being a subsequent step.

2010

Shopify's path to Rails 3 - Shopify

11/16/2010

This post details the technical challenges and strategies employed by Shopify in upgrading their large, established Rails application to Rails 3. Key contributions include: the proactive use of Bundler for dependency management prior to the upgrade, a detailed process for migrating views and helpers to address XSS vulnerabilities ('safe by default'), the refactoring of a large number of routes using the new routing API, the process of updating internal and external libraries for Rails 3 compatibility, a solution for the 'helper :all' issue using `clear_helpers`, and the thorough testing of external service integrations. It also highlights the benefits of the upgrade, such as performance improvements and a cleaner API, and looks ahead to future Rails 3.x features.