Is Switch (Case) always wrong?

后端 未结 8 825
情歌与酒
情歌与酒 2020-12-19 00:37

Are there instances where switch(case) is is a good design choice (except for simplicity) over strategy or similar patterns...

8条回答
  •  执笔经年
    2020-12-19 01:07

    it's usually ok, as long as you only have one switch in one place. when you have more than one (or many), then it's time too consider alternatives.

提交回复
热议问题