What are common misconceptions about OCP?

Answer

Several common misconceptions surround OCP: (1) "Never modify code" — OCP doesn't mean code can never change; it means that once a module is stable and tested, behavior should be extended without modifying that module. Bug fixes and initial development are exceptions. (2) "Use inheritance for extension" — inheritance is just one mechanism; composition and interfaces are often superior. (3) "Anticipate all variations" — you can't predict every future extension point. OCP should be applied where change has already been observed (after the first variation), not speculatively everywhere. (4) "OCP is about open source" — completely unrelated. (5) "OCP applies to every class" — small utility classes and value objects rarely need OCP treatment. Apply OCP proportionally to volatility: design extension points where change is likely and costly.