# Refactoring Legacy Code with the Strangler Fig Pattern

DevFeed: [Refactoring Legacy Code with the Strangler Fig Pattern](<https://devfeed.tech/articles/refactoring-legacy-code-with-the-strangler-fig-pattern-1544.md>)

Original publisher: [Read original article](<https://shopify.engineering/refactoring-legacy-code-strangler-fig-pattern>)

Author: Adrianna Chang

Published: 2020-03-11T19:00:00Z

Content type: article

Language: en

Sources: [Shopify Engineering](<https://devfeed.tech/sources/shopify-engineering.md>), [Shopify Engineering - Shopify Engineering](<https://devfeed.tech/sources/shopify-engineering-shopify-engineering.md>)

Topics: [Refactoring](<https://devfeed.tech/topics/refactoring.md>), [Shopify](<https://devfeed.tech/topics/shopify.md>), [Code](<https://devfeed.tech/topics/code.md>), [Code quality](<https://devfeed.tech/topics/code-quality.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [code-quality](<https://devfeed.tech/tags/code-quality.md>), [refactoring](<https://devfeed.tech/tags/refactoring.md>), [shopify](<https://devfeed.tech/tags/shopify.md>)

## AI overview

This article presents Shopify's use of the Strangler Fig Pattern to refactor legacy code. It focuses on the oversized Shop model in Shopify's Ruby on Rails codebase, explaining how unclear responsibilities, weak boundaries, and accumulated complexity make large objects difficult to reuse, test, and understand. The article describes efforts to move business processes into more appropriate objects or components and identifies code metrics as a possible way to choose where refactoring should begin.

## Source excerpt

There are strategies for reducing the size and responsibilities of large objects. Here's one that worked for us at Shopify, an all-in-one commerce platform supporting over 1M merchants across the globe.