I made some research about refactoring my college code. I used JDeodorant plugin for Eclipse and it throws me away, that something like that:
if (object instanceof Class1) {
do_something1();
} else if (object instanceof Class2) {
do_something2();
} else if (object instanceof Class3) {
do_something3();
}
should be replaced by Polymorphism. Everything will be fine, except that all methods do_something() refer to operations not related with object. So for me polymorphism will not work.
Is there any other way to avoid using instanceof , which seems to be unprofessional.
Thank You very much.