in reply to replace conditionals with polymorphism
This may be a good exercise, but I'm not so convinced it's the best thing to do in practice. You now have 5 classes, each with a single method? That seems a little contrived. I would stick with the switch statement.
Update: I guess you said the same thing later in your post; I should have read it more carefully. I'd still like to reinforce your feeling with my own. I wouldn't bother solving all the problems you listed.
|
---|