Skip to content

Glossary: Software Design Patterns in JavaScript

Open/closed principle (OCP)

Also written: OCP, open/closed

The O of SOLID: code should be open for extension but closed for modification, so you add behavior with new code instead of editing code that works. A new discount is a new class added to RULES.

Where the book teaches it

Related terms

SOLIDPlugin