The Open-Closed Principle (OCP) is a fundamental object-oriented design principle. In this article, I’ll explain what the Open-Closed Principle is and how to implement it effectively in your code or module.
The open closed principle is one of the five design principles of object-oriented design. These set of five principles are known as SOLID principles.
- Single Responsibility Principle
- Open-Closed Principle
- Liskov Substitution Principle
- Interface Segregation Principle
- Dependency Inversion
In my previous post, i have already explained single responsibility principle. In subsequent tutorials, I’ll cover rest of the principles.