I find that switch statements are nice for things like enums. The values are limited so the API can still be kept clear. I think the main issue with your example is with stringly-based API (status is a string) being used in a statically typed language. Its not necessarily that you're using a switch statement.
Yea Switch statement is cool but sometimes when new requirements comes up the code maintenance is going to be very hard by time so by adding new features as you mentioned new Enum for example you just need to add new class it's better than editing in the switch statement it self
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I find that switch statements are nice for things like enums. The values are limited so the API can still be kept clear. I think the main issue with your example is with stringly-based API (status is a string) being used in a statically typed language. Its not necessarily that you're using a switch statement.
Yea Switch statement is cool but sometimes when new requirements comes up the code maintenance is going to be very hard by time so by adding new features as you mentioned new Enum for example you just need to add new class it's better than editing in the switch statement it self