Top tag
Next privilege 300 Rep.
Create new tags
1 4
~4k people reached

  • 0 posts edited
  • 0 helpful flags
  • 0 votes cast
comment Martin Fowler's Refactoring book: switch statement is using other object's data, why is that bad ? A deeper explanation is sought for.
It actually wants you to avoid switch statements based on data types. Each of those types should be an object, and the task should be performed by the each class instead. The class for new releases should give the charge for new release, etc. Keep the knowledge specific about a class in the class. By doing so, you can easily add new classes without having to alter logic in the class's users.