# What is Open-Closed Principle?

Design modules so you can add behavior without editing existing code. Extend through new types, not surgery on old ones.

## In real work

Open-closed principle: we registered a new export handler instead of editing the core pipeline.

## Related terms

- [Encapsulate What Varies](https://prompthausapp.com/learn/encapsulate-what-varies.md)
- [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)
- [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/open-closed-principle
- App Store: https://apps.apple.com/us/app/prompthaus-ai-vocabulary/id6776314407
