Recently i’ve watched an intresting speech by Miško Hevery.
He explains how to use the correct polymorphic approach instead of a succession of if/switch statements. Polymorphism is better because it lets everybody to understand, to extend and to test the code.
Watch the video at: http://googletesting.blogspot.com/2008/12/by-miko-hevery-google-tech-talks.html