shredbx logo
shredbx shredbx shredbx shredbx Personal
  • Home
  • Lab
  • Portfolio
  • Experience
  • Services
  • Profile
  • Contact
AClaude
  • Home
  • Lab
  • Portfolio
  • Experience
  • Services
  • Profile
  • Contact
Andrei Solovev
Knowledge
Search knowledge... ⌘K
Knowledge · Anti-Patterns

Smell Repeated Switches

Code smell indicating repeated switch/case logic across the codebase (updated terminology from Switch Statements)

Andrei Solovev

Tags

refactoring-fowlercode-qualitymaintainabilitycode-smell2nd

Impact

In the first edition, any switch statement was suspect. With languages supporting switch on strings and first-class functions, the blanket advice is no longer valid. The problem with repeated switches is that whenever you add a clause, you must find all the switches and update them. Polymorphism provides an elegant way to handle this by ensuring additions only require a new class.

Symptoms

  • In the first edition, any switch statement was suspect. With languages supporting switch on strings and first-class functions, the blanket advice is no longer valid. The problem with repeated switches is that whenever you add a clause, you must find all the switches and update them. Polymorphism provides an elegant way to handle this by ensuring additions only require a new class.

Source

Martin Fowler — Refactoring: Improving the Design of Existing Code, 2nd

shredbx logo shredbx shredbx shredbx shredbx Andrei Solovev

Solution Architect & Lead Software Engineer

ExperiencePortfolioResearch & ExperimentsEducationCertificationSkills
GitHub ↗LinkedIn ↗Email ↗
AVAILABLE FOR NEW PROJECTS
// MY LATEST BEATS
Hobby & Interests

Lab

  • The Lab
  • Framework
  • Components
  • Packages
  • Games
  • Process (SDLC)
  • Knowledge
  • Blog

Andrei

  • Portfolio
  • Experience
  • Services
  • Profile
  • Contact
  • Lifestyle

Team

  • Team
  • Andrei
  • Claude

Legal

  • Privacy
  • Terms
  • Cookies
© 2026 shredbx.com. All rights reserved. — Andrei Solovev |