Avoiding instanceof in Java
You might be interested in this entry from Steve Yegge’s Amazon blog: “when polymorphism fails”. Essentially he’s addressing cases like this, when polymorphism causes more trouble than it solves. The issue is that to use polymorphism you have to make the logic of “handle” part of each ‘switching’ class – i.e. Integer etc. in this … Read more