Grokking SOLID Design Principles
Ask Author
Back to course home

0% completed

Vote For New Content
Introduction to Open / Closed Principle
On this page

The Open/Closed Principle (OCP) is a core design principle in software development. It is defined as:

Software entities (such as classes, modules, and functions) should be open for extension, but closed for modification.

This means that your code should be designed in a way that allows new features to be added without changing the existing code. Let’s explore this further with a general example.

General Example: Gaming Console and Add-Ons

Imagine you own a gaming console

.....

.....

.....

Like the course? Get enrolled and start learning!

On this page