# Focus On Behavior, Not State, for a More Maintainable Codebase

DevFeed: [Focus On Behavior, Not State, for a More Maintainable Codebase](<https://devfeed.tech/articles/focus-on-behavior-not-state-for-a-more-maintainable-codebase-1303.md>)

Original publisher: [Read original article](<https://shopify.engineering/behavior-not-state-for-maintainable-codebase>)

Author: J D

Published: 2022-09-01T16:00:04Z

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: [Code](<https://devfeed.tech/topics/code.md>), [API](<https://devfeed.tech/topics/api.md>), [Shopify](<https://devfeed.tech/topics/shopify.md>)

Tags: [apis](<https://devfeed.tech/tags/apis.md>), [building](<https://devfeed.tech/tags/building.md>), [code](<https://devfeed.tech/tags/code.md>), [shopify](<https://devfeed.tech/tags/shopify.md>)

## AI overview

Shopify describes how its team made a Purchase Options API codebase more maintainable by shifting from modeling objects primarily by state to designing around behavior. The approach addressed coupling between selling plans and subscriptions while supporting pre-orders and "try before you buy" features, and aimed to reduce future refactoring when adding other purchase models.

## Source excerpt

How we moved from focusing on state (what an object is) towards behavior (what an object does) while building our Purchase Options APIs as a way to create a more maintainable codebase.