2 ms·
This. If it's a small program with limited scope, switches are fine. If it's part of a much larger program, there's a chance that switch will explode to switchi
by BeetleB 10y ago
This. If it's a small program with limited scope, switches are fine. If it's part of a much larger program, there's a chance that switch will explode to switching on the same thing all over the codebase.
However, I think GP's point is valid. If during a code review I have a switch and it makes no sense to abstract it, I'd smack the reviewer on the head if he/she wants me to "fix" it.