Understanding the Open/Closed Principle
The Open/Closed Principle (OCP) is one of the S.O.L.I.D principles of object-oriented design, in particular the letter “O”.
The principle states that software entities (classes, modules, functions, etc.) should be open for extension but closed for modification.
This means you should be able to add new functionality to an existing class without changing its existing code.
Let’s review this in the full article with an example.
Originally published on iamjeremie.me


