3 ms·
Switch statements are fine for simple tasks like the one in the example, especially earlier in a project where you do not know what you need in the future. You
by extrapickles 9y ago
Switch statements are fine for simple tasks like the one in the example, especially earlier in a project where you do not know what you need in the future. You can always switch it to the correct pattern in version 2 as that way its better understood what hidden needs the code in question has, thus making it easy to pick a good OOP patern to replace it.
Then again, my jugment might be colored by working on codebases that are >21 years old.