# What is Encapsulate What Varies?

Pull the parts of your code that change into their own modules. Leave the stable parts alone.

## In real work

Encapsulate what varies: we pulled payment providers into their own module so adding Stripe does not touch checkout UI.

## Related terms

- [Composition Over Inheritance](https://prompthausapp.com/learn/composition-over-inheritance.md)
- [Program to Interface](https://prompthausapp.com/learn/program-to-interface.md)
- [Loosely Coupled](https://prompthausapp.com/learn/loosely-coupled.md)
- [Open-Closed Principle](https://prompthausapp.com/learn/open-closed-principle.md)
- [Dependency Inversion](https://prompthausapp.com/learn/dependency-inversion.md)

## How is this different from Googling it?

Google gives a definition. Prompthaus pairs each term with how it shows up in standups, PRs, prompts, and design reviews—then quizzes you until the word sticks. One term a day on iPhone.

- Category: Foundations
- HTML: https://prompthausapp.com/learn/encapsulate-what-varies
- App Store: https://apps.apple.com/us/app/prompthaus-ai-vocabulary/id6776314407
