As I put in my comment to the question, this question is interesting. The programming avoiding
ifs is a whole big topic which evoked a lot of thinking on the conceptual level.
You may find some of the articles on related topics interesting:
http://programmingwithoutifs.blogspot.com/[
^],
http://www.ewernli.com/noif[
^],
http://aigamedev.com/open/review/schematic-table-conditionals/[
^].
According to the Wikipedia article on conditional programming, dynamic dispatch can be considered as an alternative execution choice approach. Please see:
http://en.wikipedia.org/wiki/Conditional_%28programming%29[
^],
http://en.wikipedia.org/wiki/Dynamic_dispatch[
^].
However, this is pretty hard to understand. I would suggest my own CodeProject article, where I put forward my approach to the dynamic dispatch which helps to avoid
if
and
switch
statements:
Dynamic Method Dispatcher[
^].
This work includes detailed motivation, full source code and detailed usage description and samples. You may also find it all interesting.
—SA