Skip to content

Common smells of OCP violationsΒΆ

  • Many [[conditional branch]]es with if/else or switch/case statements
  • Generally you have 3 approaches to it:
    • [[Parameterization with delegates]]. "[[Chain of responsibility]]" design pattern.
    • Classic [[Inheritance]] or Visitor Design Pattern
    • [[Composition vs Inheritance]]. [[Strategy Design Pattern]].