Lexicon

Switch-Based Extension

Kind: anti-pattern

Layer: Structural Core

Record: lexicon:switch-based-extension

Canonical: Lexicon

Extending behavior by editing a growing switch or conditional on a type instead of adding a new polymorphic type.

Listed in Lexicon terms, after Fat Interface and before Type Switching.

Category

  • SOLID / Object-Oriented Design

Negated by

  • Open/Closed Principle

Violates

  • Open/Closed Principle

Linked from

  • SOLID / Object-Oriented Design