There are many projects to decompose 24 cases from one long " switch " into something else. The usual “OO” approaches would be to centralize in some kind of factory or create 24 “independent members” with the authority to do what you want.
For example, if you created 24 buttons that simply responded to its log statement when pressed, that would remove the switch. If you have additional processing (besides logging), you need to make a strategic decision to "centralize" this processing (for example, in one large switch statement, as you are now), or to "decentralize" this processing to "independent actors", ( for example, 24 “smart buttons”) that have the context and the authority to do what you want when pressed.
Then you can create a "decentralized" project: you can have one object / button "DoIt", and the state is a log message, and you simply create an instance of 24 such instances (but you have only one class). Even if 24 instances had to do completely different things, you can further abstract them in other projects, for example, create 24 objects / buttons that refer to 24 different instances of the class MyOperation1 , MyOperation2 , MyOperation3 ...
IMHO, the key design decision will be: what do you want to centralize? If they all do almost the same thing, you need one class with 24 instances. If they behave differently (you have a completely different logic in each of the case in your switch ), then you can benefit from one or more processing classes that can have a common base class and then create 24 buttons for each link per instance of the processing class.
source share