Open Closed Principle

One of the principles of Object Oriented Programming is called the Open Closed Principle. This means that modules like classes and methods should be open for extension but closed for modification. In other words, if you want to add a new feature to the system, you should be able to add new classes or, perhaps, add new methods, but you shouldn't need to change the structure of an existing class or change existing methods in order to make a change. This often occurs because of class tests, switch statements, or checking special conditions inside your code. You should be able to push those into another class and delegate to it to alleviate the need to change that method or class for every new feature added.

Download