Is switch-case over enumeration bad practice?
https://softwareengineering.stackexchange.com/questions/165802
-
05-11-2019 - |
Question
I have an enumeration with the commands Play
, Stop
and Pause
for a media player. In two classes I do a switch-case over the received commands. The player runs in a different thread and I deliver the commands in a command queue to the thread.
If I generate class diagrams the enumeration has dependencies all over the place. Is there a nicer way to deal with the commands? If I would change/extend the enumeration, I would have to change several classes. (Its not super important to keep the player extensible, but I try to write nice software.)
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with softwareengineering.stackexchange