you are viewing a single comment's thread
view the rest of the comments
[–] 3 points 2 years ago (3 children)

Google for "replace conditional with polymorphism".

Just checked and it is in "Clean Code" - Chaper 17; Section G23 "Prefer Polymorphism to if/else or switch/case".

  • source
  • parent
  • hideshow 3 child comments
  • [–] 4 points 2 years ago (1 child)

    This is really terrible advice. Sometimes it's better to do that, but definitely not in the example from this article.

    If anyone says you should always prefer polymorphism to switches they are a bloody idiot.

  • source
  • parent
  • hideshow 1 child comment