Skip to content

Glossary: Software Design Patterns in Java

Open/closed principle (OCP)

Also written: OCP, open/closed

The SOLID rule that code should be open for extension but closed for modification. A new `DiscountRule` class is added without editing old ones.

Where the book teaches it

Related terms

SOLIDPlugin