open/closed principle


open/closed principle

(programming, theory)A principle used in OOPL which statesthat a class must be open and closed where open means it hasthe ability to be extended and closed means it cannot bemodified other than by extension.

The idea is that once a class has been approved for use havinggone through code reviews, unit tests, and other qualifyingprocedures, you don't want to change the class very much, justextend it. In practice the open/closed principle simply meansmaking good use of abstraction and polymorphism.