Avoid Going Under the Hood

Write code that is open for extension but closed for modification.  Start by delivering a minimum viable product, then as the change requests begin pouring in, you will see the type of changes that are likely to come.  You can then begin applying the OCP to enable your code to be easily extended (without modification) for those types of changes.  This will help avoid over-engineering your initial solution (YAGNI).

You should not have to go under the hood (change existing code) to add functionality.

Methods Supporting OCP

Polymorphic Dispatch is a very effective method for decoupling functionality and promoting a plug-n-play architecture which aligns very well to the objective of the Open/Closed Principle (OCP).  This enables us to rewrite Switch Statements in such a way that it will eliminate the need to recompile and redeploy a module (or possibly the entire application) any time a case is added or changed.

;