Relative Content

Tag Archive for switch-statement

Is it possible to avoid enormously big switch in that case? [duplicate]

This question already has answers here: Refactoring Switch Statements and is there any real use for Switch Statements at all? (7 answers) Closed 11 years ago. I’m writing a simple chess-related code with intention to write it clearly (performance doesn’t matter at all). And this method I have doesn’t look clean to me at all: […]

Is it possible to avoid enormously big switch in that case? [duplicate]

This question already has answers here: Refactoring Switch Statements and is there any real use for Switch Statements at all? (7 answers) Closed 11 years ago. I’m writing a simple chess-related code with intention to write it clearly (performance doesn’t matter at all). And this method I have doesn’t look clean to me at all: […]

Map of functions vs switch statement

I’m working on a project that processes requests, and there are two components to the request: the command and the parameters. The handler for each command is very simple (< 10 lines, often < 5). There are at least 20 commands, and likely will have more than 50.